语法
¥Syntax
使用 JSDoc 标签字典(默认启用):
¥With the JSDoc tag dictionary (enabled by default):
@protected
使用 闭包编译器 标签字典:
¥With the Closure Compiler tag dictionary:
@protected [{typeExpression}]
概述
¥Overview
@protected
标签将符号标记为受保护。通常,此标签指示符号仅在当前模块内可用或应仅在当前模块内使用。
¥The @protected
tag marks a symbol as protected. Typically, this tag indicates that a symbol is
only available, or should only be used, within the current module.
默认情况下,标有 @protected
标签的符号将出现在你的文档中。在 JSDoc 3.3.0 及更高版本中,你可以使用 -a/--access
命令行选项 来更改此行为。
¥By default, symbols marked with the @protected
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.
@protected
标签相当于 @access protected
。
¥The @protected
tag is equivalent to @access protected
.
示例
¥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 protected:
/** @constructor */
function Thingy() {
/** @protected */
this._bar = 1;
}