Skip to content
nene edited this page Mar 21, 2012 · 3 revisions

Synopsis:

@constructor
Documentation for constructor.

Allows documenting the constructor within class documentation.

This tag is provided for backwards compatibility with old ext-doc. Don't use it for new code. Instead document a method named constructor (see below).

Example:

/**
 * @class Ext.Panel
 * The one-and-only panel class.
 *
 * @constructor
 * Creates a new Panel instance.
 * @param {Object} [config] Configuration.
 */

JSDuck will treat everything following @constructor as being part of a constructor method. The above is equivalent of documenting a method named constructor inside the class:

/**
 * The one-and-only panel class.
 */
Ext.define("Ext.Panel", {
    /**
     * Creates a new Panel instance.
     * @param {Object} [config] Configuration.
     */
    constructor: function() {
    }
});

This is the recommended way of documenting the constructor.

Clone this wiki locally