Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Documenting member functions with JSDoc

I have something like this:

/**
Diese Klasse bla bla...
@constructor 
**/
my.namespace.ClassA = function(type)
{
   /**
   This function does something
   **/
   this.doSomething = function(param){
   }
}

The class will get listed in the generated documentation. The function won't. Is there a way to tell JSDoc (3) that this is a member function of the class ClassA?

like image 206
Chris Avatar asked Sep 23 '13 11:09

Chris


2 Answers

Try this!

/**
  * Diese Klasse bla bla...
  * @constructor 
*/
my.namespace.ClassA = function(type)
{
   /**
    * This function does something
    * @function doSomething
    * @memberOf my.namespace.ClassA#
   */
   this.doSomething = function(param){
   };
};

JSDoc seems quite clunky in this area :/ The key is to specify both memberof and the name of the function. See also.

like image 102
Chris Avatar answered Sep 19 '22 03:09

Chris


JSDoc needs some additional information to recognize the function as member function:

/**
  * Diese Klasse bla bla...
  * @constructor 
*/
my.namespace.ClassA = function(type)
{
   /**
    * This function does something
    * @function
    * @memberOf my.namespace.ClassA
   */
   this.doSomething = function(param){
   }
}
like image 33
Matti Lehtinen Avatar answered Sep 23 '22 03:09

Matti Lehtinen