JSDoc和JavaScript单例文档 [英] JSDoc and JavaScript singleton documentation

查看:71
本文介绍了JSDoc和JavaScript单例文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将JavaScript单例定义为:

I have a JavaScript singleton defined as:

/**
 * 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();

})();

没有以详细模式(-v)打印警告,但文档仅报告com.mydomain .ClassName()with这里描述作为描述......我怎样才能为ClassName的方法生成文档?

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

推荐答案

我解决了! :)

  /**
 * 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();

})();

我刚用@name替换@lends!

I just replaced @lends with @name!

更新:获得完整文档的正确方法如下:

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

var ClassName = function(){};

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

return new ClassName();

})();

这篇关于JSDoc和JavaScript单例文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆