最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

JSDoc and JavaScript singleton documentation - Stack Overflow

programmeradmin0浏览0评论

I have a JavaScript singleton defined as:

/**
 * A description here
 * @class
 */
.mydomain.ClassName = (function(){

/**
 * @constructor
 * @lends .mydomain.ClassName
 */ 
var ClassName = function(){};

/**
 * method description
 * @public
 * @lends .mydomain.ClassName
*/
ClassName.prototype.method1 = function(){};

return new ClassName();

})();

No warnings are printed in verbose mode (-v), but the documentation reports only ".mydomain.ClassName()" with "A description here" as description... how can I generate documentation for ClassName's methods too?

I have a JavaScript singleton defined as:

/**
 * A description here
 * @class
 */
.mydomain.ClassName = (function(){

/**
 * @constructor
 * @lends .mydomain.ClassName
 */ 
var ClassName = function(){};

/**
 * method description
 * @public
 * @lends .mydomain.ClassName
*/
ClassName.prototype.method1 = function(){};

return new ClassName();

})();

No warnings are printed in verbose mode (-v), but the documentation reports only ".mydomain.ClassName()" with "A description here" as description... how can I generate documentation for ClassName's methods too?

Share Improve this question asked Sep 7, 2012 at 10:05 daveoncodedaveoncode 19.6k19 gold badges108 silver badges162 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

I solved! :)

  /**
 * A description here
 * @class
 */
.mydomain.ClassName = (function(){

/**
 * @constructor
 * @name .mydomain.ClassName
 */ 
var ClassName = function(){};

/**
 * method description
 * @public
 * @name .mydomain.ClassName.method1
*/
ClassName.prototype.method1 = function(){};

return new ClassName();

})();

I just replaced @lends with @name!

UPDATE: the right approach in order to have the full documentation is the following:

/**
 * A description here
 * @class
 */
.mydomain.ClassName = (function(){

var ClassName = function(){};

/**
 * method description
 * @memberOf .mydomain.ClassName
*/
ClassName.prototype.method1 = function(){};

return new ClassName();

})();
发布评论

评论列表(0)

  1. 暂无评论