JSDoc 中文网

Synonyms

语法

🌐 Syntax

@function [<FunctionName>]

概述

🌐 Overview

这将一个对象标记为函数,即使解析器看起来可能并不认为它是函数。它将文档注释的 @亲切 设置为 'function'。

🌐 This marks an object as being a function, even though it may not appear to be one to the parser. It sets the doclet's @kind to 'function'.

示例

🌐 Examples

使用 @function 来标记一个函数。
/** @function */
var paginate = paginateFactory(pages);

如果没有 @function 标签,paginate 对象将被记录为通用对象(一个 @成员),因为仅通过检查代码行无法判断 paginate 在运行时将保存哪种类型的值。

🌐 Without the @function tag, the paginate object would be documented as a generic object (a @member), because it isn't possible to tell from examining the line of code what type of value paginate will hold when it is run.

使用带名称的 @function。
/** @function myFunction */

// the above is the same as:
/** @function
 * @name myFunction */