@static

nene edited this page Aug 9, 2012 · 5 revisions

(Updated for JSDuck 4)

Synopsis:

@static

Marks member as static.

Ext4 has a special statics: block for defining static properties and method, JSDuck 4 understands this and will detect such members as static automatically:

/**
 * Represents an HTML fragment template.
 */
Ext.define("Ext.Template", {
    statics: {
        /**
         * Creates a template from the passed element's value.
         */
        from: function() { ... }
    }
});

When static method are defined elsewhere, a @static tag is required:

/**
 * Creates a template from the passed element's value.
 * @static
 */
Ext.Template.from = function() { ... };

Inheritable statics

Similarly when static member is defined inside inheritableStatics: block it will be documented as a static method and the documentation will be inherited by subclasses:

/**
 * Represents an HTML fragment template.
 */
Ext.define("Ext.Template", {
    inheritableStatics: {
        /**
         * Creates a template from the passed element's value.
         */
        from: function() { ... }
    }
});

In cases where JSDuck is unable to auto-detect inheritableStatics: block one needs to explicitly tell him by using both @static and @inheritable tag:

/**
 * Represents an HTML fragment template.
 */
Ext.define("Ext.Template", function() {
    return {
        inheritableStatics: {
            /**
             * Creates a template from the passed element's value.
             * @static
             * @inheritable
             */
            from: function() { ... }
        }
    }
});