How to Document following function in JSDoc JS-Toolkit -
*how document following function in jsdoc js-toolkit *
i want document try , help method in main function did not figure out how that.
/** sample doc * @class * @constructor * @name sample */ var main=function(){ this.value=""; /** function * @param {string} name */ this.help=function(name){ console.log('help me'+name); } /** function * @param {string} name */ this.try=function(name){ console.log('try me'+name); } }
i struggled several hours. tried:
@member@augments@method@this
from examples , tutorials found, member functions , variables should appear in output having /** description/* comments above them, found not case. you, i'm using standard javascript constructors, this should able inferred automatically due @constructor being in place. maybe there's wrinkle i'm not seeing.
in end, found 2 tags worked me, @name and@memberof. both allow specify object property member of. using @name in way undocumented (at least, didn't see anywhere), straightforward. you'll need use @function.
here's example @name tag:
/** function * @name sample.try * @function * @param {string} name */ this.try=function(name){ console.log('try me'+name); }; 
and here's example @memberof tag:
/** function * @memberof sample * @function * @param {string} name */ this.try=function(name){ console.log('try me'+name); }; 
as can see output same. difference see @memberof includes this. in method name. reason i've settled on using @name.
the remaining issue functions per-instance, not <static>.
hope helps!
Comments
Post a Comment