Chris Chris - 6 months ago 13
Javascript Question

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
?

Answer

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){
   }
}