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;