Re: [Jsdoc-user] how to find functions in Object.extend? (pls ignore prev mesg)
Status: Inactive
Brought to you by:
mmathews
From: Gabriel R. <gab...@gm...> - 2005-09-16 17:40:16
|
On Thu, Sep 15, 2005 at 06:01:07PM -0700, EventListener wrote: > I am using the prototype.js library to extend Objects. > Any suggestions on how to get methods declared like this to show up in the > documentation? > > Here is an example of what I'm doing: > > Example = Class.create(); > Example.prototype = Object.extend( new Example(), { > > /** > This comment isn't found > */ > initialize: function() > { > > } > } At the moment, there isn't a way of getting JSDoc to recognize this kind of construct (at least, as far as I'm aware). JSDoc can't "understand" what's going on here, because it's actually just an anonymous definition where the initialize function is declared. I've just looked at the prototype.js code, and noticed that the Object.extend method simply copies all properties from the second argument into the first argument. As a result, the above code could be written as follows, with (I believe) the same result: Example = Class.create(); Example.prototype = { /** This comment is found */ initialize: function() { } }; The above code will be correctly recognized by JSDoc. Unfortunately, support for things as dynamic as what you originally posted just isn't available right now. If it were to be supported, it would have to be done purely with '@' tags. If you've got some suggestions on how this could be done in a general manner (from the point of view of the actual documentation in the JavaScript code), please let me know. Regards, Gabriel |