2012-09-07 7 views
5

ich einen JavaScript-Singletons haben wie folgt definiert:JSDoc und JavaScript Singletons Dokumentation

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

})(); 

keine Warnungen im ausführlichen Modus gedruckt werden (-v), aber die Dokumentation Berichte nur „com.mydomain.ClassName()“ mit "Eine Beschreibung hier" als Beschreibung ... Wie kann ich auch Dokumentation für die Methoden von ClassName generieren?

Antwort

7

Ich löste! :)

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

})(); 

Ich habe gerade @Lends mit @name ersetzt!

UPDATE: der richtige Ansatz, um die vollständige Dokumentation zu haben, ist die folgende:

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

var ClassName = function(){}; 

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

return new ClassName(); 

})();