JSDoc 中文网

概述

🌐 Overview

@public 标签表示一个符号应被记录,就像它是公共的一样。

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

默认情况下,JSDoc 将所有符号视为公共的,所以使用这个标签通常不会影响生成的文档。然而,你可能更希望显式使用 @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.

在 JSDoc 3 中,@public 标签不会影响符号的作用域。使用 @instance@static@global 标签可以更改符号的作用域。

🌐 In JSDoc 3, the @public tag does not affect a symbol's scope. Use the @instance, @static, and @global tags to change a symbol's scope.

示例

🌐 Examples

使用 @public 标签
/**
 * 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;
}