Reputation: 1691
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 :)
Upvotes: 4
Views: 1128
Reputation: 7045
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.
Upvotes: 3
Reputation: 319
Only thing I could come up with is to remove @extend. I added a link to the extended class manually to the description. This works for me in this instance because I do not need @extends for anything else.
Upvotes: 1