JSDoc 中文网

语法

🌐 Syntax

@license <identifier>

概述

🌐 Overview

@license 标签用于标识适用于你代码任何部分的软件许可证。

🌐 The @license tag identifies the software license that applies to any portion of your code.

你可以使用任何文本来识别你正在使用的许可证。如果你的代码使用标准开源许可证,请考虑使用 软件包数据交换(SPDX)许可证列表 中的适当标识符。

🌐 You can use any text to identify the license you are using. If your code uses a standard open-source license, consider using the appropriate identifier from the Software Package Data Exchange (SPDX) License List.

一些 JavaScript 处理工具,例如 Google 的 Closure Compiler,会自动保留包含 @license 标签的任何 JSDoc 注释。如果你正在使用这些工具之一,你可能希望添加一个单独的 JSDoc 注释,其中包含 @license 标签,以及整个许可证的文本,这样许可证文本就会包含在生成的 JavaScript 文件中。

🌐 Some JavaScript processing tools, such as Google's Closure Compiler, will automatically preserve any JSDoc comment that includes a @license tag. If you are using one of these tools, you may wish to add a standalone JSDoc comment that includes the @license tag, along with the entire text of the license, so that the license text will be included in generated JavaScript files.

示例

🌐 Examples

一个根据 Apache 许可证 2.0 分发的模块
/**
 * Utility functions for the foo package.
 * @module foo/util
 * @license Apache-2.0
 */
一个包含完整 MIT 许可证的独立 JSDoc 注释
/**
 * @license
 * Copyright (c) 2015 Example Corporation Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */