Synonyms
yield
语法
🌐 Syntax
@yields [{type}] [description]
概述
🌐 Overview
@yields 标签记录生成器函数生成的值。该标签在 JSDoc 3.5.0 及更高版本中可用。
🌐 The @yields tag documents the value that is yielded by a generator function. This tag is available
in JSDoc 3.5.0 and later.
如果你正在记录一个普通函数,请使用 @returns 标签 而不是这个标签。
🌐 If you are documenting a regular function, use the @returns tag instead of this
tag.
示例
🌐 Examples
/**
* Generate the Fibonacci sequence of numbers.
*
* @yields {number}
*/
function* fibonacci() {}
/**
* Generate the Fibonacci sequence of numbers.
*
* @yields {number} The next number in the Fibonacci sequence.
*/
function* fibonacci() {}