Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jsdoc hide Inherited method (in generated doc)

I'm using jsdoc to generate online doc for my javascript project.

It works fine except one problem I'm having right now.

Say I have a base class with lots of get/set functions.

/**
 * cc.BaseClass
 * @class
 * @extends cc.Class
 */
cc.BaseClass = cc.Class.extend(/** @lends cc.BaseClass# */{
    /** 
     * @param {number} a
     */
    setA:function(a){},
    /** 
     * @return {number}
     */
    getA:function(){},
    // ...... 20+ more
});

Then I have a child class which extends the base class.

/**
 * cc.ChildClass
 * @class
 * @extends cc.BaseClass
 */
cc.ChildClass = cc.BaseClass.extend(/** @lends cc.ChildClass# */{
    /** 
     * @param {number} xxx
     */
    myFunction:function(xxx){}
});

My problem is the generated online DOC for the cc.ChildClass contains the "myFunction:function" along with the 20+ get/set functions inherited from the cc.BaseClass.

I know there is nothing wrong about this but I want to know if there is a way to hide all the 20+ get/set functions inherited from the cc.BaseClass in the doc for cc.ChildClass.

Think if I have cc.ChildClassA cc.ChildClassB cc.ChildClassC ... then I don't want to see each of their doc contains the 20+ get/set functions inherited from the cc.BaseClass.

Any suggestion will be appreciated, thanks :)

like image 849
supersuraccoon Avatar asked Oct 26 '25 09:10

supersuraccoon


1 Answers

You shoudn't adapt your code / classes for satisfying this. This should be the responsiblity of the template. This one does the trick very well: https://github.com/steveush/foodoc - demo: https://cancerberosgx.github.io/jsdoc-templates-demo/demo/foodoc/Apple.html . Another one that supports it is ibm's amddcl. In the following look for https://cancerberosgx.github.io/jsdoc-templates-demo/demo/amddcl/Apple.html#

Some other templates dont show inherithed at all and dont allwo the user to toccle - which I also dont want. I think foodoc allows both the user and the compiler-person to configure it nicely.

BTW I'm trying to collect well known jsdoc templates demos here https://cancerberosgx.github.io/jsdoc-templates-demo/demo/ - for each there are installation instructions.

like image 57
cancerbero Avatar answered Oct 29 '25 00:10

cancerbero



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!