@private

nene edited this page Aug 9, 2012 · 3 revisions

(Updated for JSDuck 4)

Synopsis:

@private

Documents the visibility of a member as private. Private members may only be used from within the class itself.

In class context it marks the class that's only meant to be used internally by the software package.

Example:

/**
 * Private utility class that manages the internal Shadow cache.
 * @private
 */
Ext.define("Ext.ShadowPool", {
    /**
     * The pool of shadows.
     * @private
     */
    shadows: [],

    defaultShadow: {},

    /**
     * Adds a shadow to the pool.
     */
    push: function(sh) {
        this.shadows.push(this.cleanup(sh));
    },

    // A helper method
    cleanup: function(sh) {
        return sh || this.defaultShadow;
    }
});

Within Ext.define() all members without a doc-comment will default to being private. So the cleanup method and defaultShadow property will both show up in documentation as private in addition to the shadows property that has an explicit @private tag.

See also @protected for documenting members that may also be accessed from subclasses.