加载中...

@license


描述: 标识你的代码采用何种软件许可协议。

语法

@license <identifier>

概述

@license标签标识你的代码采用何种软件许可协议。

你可以用任何文本来明确您所使用的许可证。如果您的代码使用一个标准的开源许可,考虑使用 Software Package Data Exchange (SPDX)许可列表中合适的标识符。

一些JavaScript处理工具,如谷歌的 Closure Compiler,会自动保留包含@license标签的JSDoc注释块。如果您在使用这些工具之一,您可能希望增加一个包含@license标签的独立的JSDoc注释块,后面加上许可的全部文本,从而使许可证文本将被包含在生成的JavaScript文件中。

Examples

例如,这是在Apache 2.0 许可下分发的模块:

  1. /**
  2. * Utility functions for the foo package.
  3. * @module foo/util
  4. * @license Apache-2.0
  5. */

一个独立的JSDoc注释块,包含完整的MIT许可:

  1. /**
  2. * @license
  3. * Copyright (c) 2015 Example Corporation Inc.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6. * of this software and associated documentation files (the "Software"), to deal
  7. * in the Software without restriction, including without limitation the rights
  8. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. * copies of the Software, and to permit persons to whom the Software is
  10. * furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included in all
  13. * copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. * SOFTWARE.
  22. */

还没有评论.