概述
¥Overview
提供如何使用记录项目的示例。该标签后面的文本将显示为高亮的代码。
¥Provide an example of how to use a documented item. The text that follows this tag will be displayed as highlighted code.
示例
¥Examples
请注意,一个 doclet 可能有多个示例。
¥Note that a doclet may have multiple examples.
/**
* Solves equations of the form a * x = b
* @example
* // returns 2
* globalNS.method1(5, 10);
* @example
* // returns 3
* globalNS.method(5, 15);
* @returns {Number} Returns the value of x for the equation.
*/
globalNS.method1 = function (a, b) {
return b / a;
};
还可以在 @example 标签后使用 <caption></caption>
为示例添加标题。
¥Examples can also be captioned using <caption></caption>
after the @example tag.
/**
* Solves equations of the form a * x = b
* @example <caption>Example usage of method1.</caption>
* // returns 2
* globalNS.method1(5, 10);
* @returns {Number} Returns the value of x for the equation.
*/
globalNS.method1 = function (a, b) {
return b / a;
};