JavaScript Tips

  JavaScript ObjectsMarch 19, 2007 16:24

Here's a simple JavaScript object:

function MyObject(a){

this.a = a;

// Alternatives for method creation:

this.function1 = MyObject_function1;

this.function2 = new Function('x', 'if(x){ return 1; } else { return 0;}");

this.function3 = function(y){if(y){ return 1; } else { return 0;}};

}

function MyObject_function1(z){

if(z){ return 1; } else { return 0;}

}

Declare the new object:

myObject = new MyObject(1);

  JSDocMarch 13, 2007 13:16

OK... I've been looking for this for a while, but never did the obvious search, so I never found it.

deCarta's developers used JSDoc to build JavaDoc-type documentation for their JavaScript. It's pretty nice... simply required an ActivePerl install (on Windows) and very minor configuration. I was able to doc my own JavaScript files in less that 10 minutes including the download.

Very cool.

 
 
Restricted access
Please sign in:
Username:
Password:
expire cookies