Skip to content
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,