【发布时间】:2017-06-08 06:41:45
【问题描述】:
我正在尝试找出将 jsdoc3 与闭包字典结合使用的 jsdoc 的最佳方法。下面的代码几乎符合我的要求,但 @class 标签在文档中添加了一个新关键字,我也对使用类定义感到不安,因为它不是真正的类。
/**
* myObject constructor. <strong> Do not use with new.</strong>
* @class myObject
* @param {string} someText The text to store
*/
function myObject (someText) {
var instance = Object.create(myObject.prototype);
instance.someText = someText;
return instance;
}
/**
* Outputs to the console
*/
myObject.prototype.doSomething = function () {
console.log(this.someText);
};
var test = myObject('foobar');
test.doSomething();
@namespace 最初似乎是一个更好的选择,但它不允许在伪构造函数上记录 @param 或类似内容。任何帮助表示赞赏。
【问题讨论】:
标签: javascript google-closure jsdoc jsdoc3