@public

May 18, 2022 0 Comments

Overview

The @public tag indicates that a symbol should be documented as if it were public.

By default, JSDoc treats all symbols as public, so using this tag does not normally affect the generated documentation. However, you may prefer to use the @public tag explicitly so it is clear to others that you intended to make the symbol public.

In contrast to previous version of JSDoc, the @public tag does not affect a symbol’s scope. Use the @instance, @static, and @global to change a symbol’s scope.

Examples

Using the @public tag
/**
 * The Thingy class is available to all.
 * @public
 * @class
 */
function Thingy() {
    /**
     * The Thingy~foo member. Note that 'foo' is still an inner member
     * of 'Thingy', in spite of the @public tag.
     * @public
     */
    var foo = 0;
}

See Also

  • @protected
  • @private
  • @access, which encompasses @private, @protected, and @public.
  • @instance, @static, and @global for modifying the scope of a symbol.