语法
¥Syntax
使用 JSDoc 标签字典(默认启用):
¥With the JSDoc tag dictionary (enabled by default):
@package
使用 闭包编译器 标签字典:
¥With the Closure Compiler tag dictionary:
@package [{typeExpression}]
概述
¥Overview
@package
标记将符号标记为包私有的。通常,此标记指示符号仅可用于与该符号的源文件位于同一目录中的代码。此标签在 JSDoc 3.5.0 及更高版本中可用。
¥The @package
tag marks a symbol as package-private. Typically, this tag indicates that a symbol is
available only to code in the same directory as the source file for this symbol. This tag is
available in JSDoc 3.5.0 and later.
默认情况下,标有 @package
标签的符号将出现在你的文档中。在 JSDoc 3.3.0 及更高版本中,你可以使用 -a/--access
命令行选项 来更改此行为。
¥By default, symbols marked with the @package
tag will appear in your documentation. In JSDoc
3.3.0 and later, you can use the -a/--access
command-line option to change this
behavior.
@package
标签相当于 @access package
。
¥The @package
tag is equivalent to @access package
.
示例
¥Examples
在以下示例中,实例成员 Thingy#_bar
出现在生成的文档中,但带有指示它是包私有的注释:
¥In the following example, the instance member Thingy#_bar
appears in the generated documentation,
but with an annotation indicating that it is package-private:
/** @constructor */
function Thingy() {
/** @package */
this._bar = 1;
}