@singleton

nene edited this page Mar 21, 2012 · 3 revisions

Synopsis:

@singleton

Documents class as a singleton.

A singleton class is a single instance of itself. Because a class instance can't have static members, JSDuck will print a warning when a singleton class contains a member marked with @static. Parent classes may contain static members though.

Example:

/**
 * @class Ext.ComponentQuery
 * Provides searching of Components.
 * @singleton
 */

Auto-detection

This tag is auto-detected when class comment is right above Ext.define which contains singleton: true. The following code is equivalent of the above one:

/**
 * Provides searching of Components.
 */
Ext.define("Ext.ComponentQuery", {
    singleton: true,
});

If for some odd reason you don't want the class to be auto-detected as singleton, use the @ignore tag:

/** @ignore */
singleton: true,
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.