JSDoc 中文网

概述

🌐 Overview

@global 标签指定一个符号应在文档中作为 全局 符号出现。JSDoc 会忽略符号在源文件中的实际作用域。这个标签对于那些先在本地定义,然后被赋值给全局符号的符号尤其有用。

🌐 The @global tag specifies that a symbol should appear in the documentation as a global symbol. JSDoc ignores the symbol's actual scope within the source file. This tag is especially useful for symbols that are defined locally, then assigned to a global symbol.

示例

🌐 Examples

使用 @global 标记指定应将符号记录为全局符号。

🌐 Use the @global tag to specify that a symbol should be documented as global.

将内部变量记录为全局变量
(function() {
    /** @global */
    var foo = 'hello foo';

    this.foo = foo;
}).apply(window);