Skip to content
Rene Saarsoo edited this page May 28, 2013 · 2 revisions

Synopsis:

This documentation gets inherited.

@localdoc This documentation is only visible
inside this class/member.

Defines a documentation block that's not meant to be inherited.

When using @inheritdoc, one often faces a problem where you want two members to feature the same documentation, but you'd also like to add a little section that's slightly different - like cross-referencing the other member you're aliasing.

That's where @localdoc steps in. Best explained with an example:

/**
 * Adds a listener for an event.
 * @localdoc See also the {@link #on} shorthand.
 * @param {String} event Name of the event to listen.
 * @param {Function} callback A function to execute.
 * @param {Object} scope A this value.
 */
addListener: function(event, callback, scope) {
},

/**
 * @inheritdoc #addListener
 * @localdoc Shorthand alias for {@link #addListener}
 */
on: function() {
    this.addListener.apply(this, arguments);
}

Here's what the resulting documentation will look like:

Screenshot demonstrating @localdoc effect