我有一个JavaScript单例定义为:
/**
* A description here
* @class
*/
com.mydomain.ClassName = (function(){
/**
* @constructor
* @lends com.mydomain.ClassName
*/
var ClassName = function(){};
/**
* method description
* @public
* @lends com.mydomain.ClassName
*/
ClassName.prototype.method1 = function(){};
return new ClassName();
})();
Run Code Online (Sandbox Code Playgroud)
没有以详细模式(-v)打印警告,但文档仅报告"com.mydomain.ClassName()"以及"此处描述"作为描述...如何为ClassName的方法生成文档?
我解决了!:)
/**
* A description here
* @class
*/
com.mydomain.ClassName = (function(){
/**
* @constructor
* @name com.mydomain.ClassName
*/
var ClassName = function(){};
/**
* method description
* @public
* @name com.mydomain.ClassName.method1
*/
ClassName.prototype.method1 = function(){};
return new ClassName();
})();
Run Code Online (Sandbox Code Playgroud)
我刚刚用@name替换了@lends!
更新:正确的方法,以获得完整的文档如下:
/**
* A description here
* @class
*/
com.mydomain.ClassName = (function(){
var ClassName = function(){};
/**
* method description
* @memberOf com.mydomain.ClassName
*/
ClassName.prototype.method1 = function(){};
return new ClassName();
})();
Run Code Online (Sandbox Code Playgroud)