Documenting member functions with JSDoc

醉酒当歌 提交于 2019-12-04 07:07:53

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

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.

You need to explicitly describe the function using full namepath. There are 3 types of namepath syntaxes to describe functions:

Person#say  // the instance method named "say."
Person.say  // the static method named "say."
Person~say  // the inner method named "say."

See details in this page.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!