2012-09-07 21 views
5

Tôi có một singleton Javascript định nghĩa là:JSDoc và JavaScript tài liệu singleton

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

})(); 

Không có cảnh báo được in trong chế độ (-v) tiết, nhưng các báo cáo tài liệu chỉ "com.mydomain.ClassName()" với "Mô tả ở đây" làm mô tả ... làm cách nào tôi có thể tạo tài liệu cho các phương thức của ClassName?

Trả lời

7

Tôi đã giải quyết! :)

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

})(); 

Tôi vừa thay @lends bằng @name!

UPDATE: cách tiếp cận đúng để có tài liệu đầy đủ như sau:

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

var ClassName = function(){}; 

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

return new ClassName(); 

})(); 
Các vấn đề liên quan