JSDoc 中文网

Synonyms

语法

¥Syntax

@function [<FunctionName>]

概述

¥Overview

这将一个对象标记为一个函数,即使它对于解析器来说可能不是一个函数。它将 doclet 的 @kind 设置为 '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 对象将被记录为通用对象(@member),因为无法通过检查代码行来判断 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 */