How to display Javascript methods in a 'group' in JSDOC?

后端 未结 1 1646
萌比男神i
萌比男神i 2021-02-05 23:28

Is there are possibility to \'group\' functions within a class (AMD/RequireJS Module) ? My classes have sometimes over 20+ functions which actually belong to a specific \'interf

1条回答
  •  别跟我提以往
    2021-02-05 23:39

    this is one way to do it, your module shape may very, but this works with classes and modules:

    /**
    * @module foobar
    *
    * @memberof module:foobar
    * @param {string} arg an argument
    **/
    function one (arg) {
        console.log(arg)
    }
    module.exports = {
        one: one
    }
    

    the key is to use @memberof, documented here.

    you can use it with @class documentation, or @module documentation, so it can work with any variety of ES5, ES6, or TypeScript Class or Module shapes, so long as you document the container object (class or module) with @class or @module.

    result:

    0 讨论(0)
提交回复
热议问题