[Jsdoc-user] Fwd: JSON object containing functions
Status: Inactive
Brought to you by:
mmathews
|
From: Ian P. <isp...@gm...> - 2006-08-09 01:51:55
|
Sorry, should have sent this to the list.
---------- Forwarded message ----------
From: Ian Petersen <isp...@gm...>
Date: Aug 8, 2006 9:51 PM
Subject: Re: [Jsdoc-user] JSON object containing functions
To: Ryan Parman <sky...@ya...>
You can change the syntax to look like this:
var favorites;
favorites = new function() {
this.loadMe = function() {
// loadMe implementation here
};
// keep going, changing
// foo: bar
// to
// this.foo = bar
};
It's functionally equivalent, gives you the ability to create really
private variables, if you like, and allows JSDoc to document the whole
thing.
Ian
On 8/8/06, Ryan Parman <sky...@ya...> wrote:
> I have some functions that I want to document, but
> because they're within an object, JSDoc won't document
> it. Here's a sample:
>
> /**
> * This is the parent container for all of the
> functions relating to this portlet.
> * @author Ryan Parman
> * @version 20060807
> */
> var favorites = {
> /**
> * This is the function that gets fired when the
> portlet loads. Anything that needs to fire with the
> portlet load MUST be called within this function.
> * @author Ryan Parman
> * @version 20060807
> */
> loadMe:function() {
> // Hide items that need to be hidden by default
> this.defaultHide();
>
> // Read JSON object and generate lists
> this.buildListNode(jsonListItems);
>
> // Make the lists sortable
> this.makeSortable();
>
> // Apply event handlers
> Behaviour.register(favorites_rules);
>
> // Set these up for canceling
> var FAVORITES_CURRENT_ACTIVE=null;
> var FAVORITES_CURRENT_INACTIVE=null;
> },
>
>
> /**
> * Hide the elements that need to be hidden by
> default.
> * @author Ryan Parman
> * @version 20060807
> */
> defaultHide:function() {
> Element.hide('edit-controls');
> Element.hide('save-controls');
> Element.hide('add_panel');
> $('add_submit').disabled=true;
> }
> }
>
> If I change "var favorites" to "function favorites()",
> I'll get the documentation generated, but the
> JavaScript syntax doesn't work right (favorites.loadMe()).
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Jsdoc-user mailing list
> Jsd...@li...
> https://lists.sourceforge.net/lists/listinfo/jsdoc-user
>
--
Tired of pop-ups, security holes, and spyware?
Try Firefox: http://www.getfirefox.com
--
Tired of pop-ups, security holes, and spyware?
Try Firefox: http://www.getfirefox.com
|