JSDoc 中文网

概述

¥Overview

@static 标记表示符号包含在父级中,并且可以在不实例化父级的情况下进行访问。

¥The @static tag indicates that a symbol is contained within a parent and can be accessed without instantiating the parent.

使用 @static 标签将覆盖符号的默认范围,但有一个例外:全局范围内的符号将保持全局。

¥Using the @static tag will override a symbol's default scope, with one exception: Symbols in global scope will remain global.

示例

¥Examples

以下示例与编写 "@function MyNamespace.myFunction" 并省略 @memberof 和 @static 标记具有相同的效果:

¥The following example has the same effect as writing "@function MyNamespace.myFunction" and omitting the @memberof and @static tags:

在虚拟注释中使用@static
/** @namespace MyNamespace */

/**

 * @function myFunction

 * @memberof MyNamespace

 * @static
 */

以下示例强制将模块的内部成员记录为静态成员:

¥The following example forces a module's inner member to be documented as a static member:

使用@static 覆盖默认范围
/** @module Rollerskate */

/**

 * The 'wheel' variable is documented as Rollerskate.wheel

 * rather than Rollerskate~wheel.

 * @static
 */
var wheel = 1;