我试图记录一个函数生成器,但没有成功,以下是一个例子:
function genericObjectGenerator(tagname) {
var specificObject = function () {};
specificObject.getClassName = function () {
return tagname;
}
specificObject.prototype.sayHello = function(name) {
return tagname + " says hello to " + name;
}
return specificObject;
}
var MyObject = genericObjectGenerator("object1");
var myObjectInstance = new MyObject();
myObjectInstance.sayHello();
我应该如何记录genericObjectGenerator和specificObject函数,以便JSDoc(和IntelliJ)能够正确解析sayHello。