Skip to content
nene edited this page Nov 26, 2012 · 4 revisions

(Available since JSDuck 4.0)

Synopsis:

@override OverriddenClassName

Documents an Ext JS 4 style override. When used in class doc-comment all the members of the class will be moved over to the class identified by OverriddenClassName as if they were defined inside that class. The class with the @override tag will not show up in documentation.

Auto-detection

One should rarely need to use the @override tag directly as the override: property inside Ext.define() is auto-detected.

/** */
Ext.define("My.Element.Override", {
    override: "Ext.dom.Element",

    /** An additional method for Ext.dom.Element */
    blowUp: function() {
        // amazing graphics manipulation code here
    }
};

The blowUp method will be moved over to Ext.dom.Element and the My.Element.Override class itself will be discarded from documentation. Though the method will get a small note saying that it originates from an override named My.Element.Override. If the Ext.dom.Element already has a blowUp method, then the documentation from the override will be appended to the docs of that method.

Explicit use of @override tag

However, if you're not using Ext.define to create the override, you need to use the @override tag explicitly. The following code will result in equivalent docs:

/**
 * @class My.Element.Override
 * @override Ext.dom.Element
 */
Ext.override(Ext.dom.Element, {
    /**
     * An additional method for Ext.dom.Element
     */
    blowUp: function() {
        // amazing graphics manipulation code here
    }
});

Note that you need to use @class tag and give some kind of name for your override. The name won't show up anywhere in the docs, but Ext JS 4 requires overrides to have a name. The problem is that the above code is not really an Ext JS 4 override - it simply overrides a method within a class, but it doesn't create a separate override-class. Therefore it's usually better to just use a @class tag - all members will then simply be added to that class:

/**
 * @class Ext.dom.Element
 */
Ext.override(Ext.dom.Element, {
    /**
     * An additional method for Ext.dom.Element
     */
    blowUp: function() {
        // amazing graphics manipulation code here
    }
});

The only problem is, that this only works for adding new members to a class. If you override an existing method, JSDuck will complain about duplicate members in class - in that case you need to go back and still use the @override tag.

Clone this wiki locally