JSDoc 中文网

语法

🌐 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:

使用 @package 标签
/** @constructor */
function Thingy() {
    /** @package */
    this._bar = 1;
}