Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Singleton Pattern Externs Inference Support

David Nolen edited this pageFeb 10, 2017 ·3 revisions

The Problem

Currently externs inference is well suited for interop patterns that involve foreign JS instances, for example a function that takes a instance ofReact.Element. However, the feature is poorly suited for the popular singleton pattern employed by libraries like jQuery and D3 where all the interesting operations are provided through a single instance. In this case, the user will see many warnings about generated externs onObject but this is exactly what the user wants.

Proposed Solution

Support additional metadata to support the singleton pattern and suppress undesirable warnings.

(def ^:singleton $ (js/require"jQuery"))

Alternative name -:js/singleton.

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp