In YUIDoc @class
is used for both classical classes and for objects which contain a bunch of methods. Classes that are meant to be instantiated are also marked with @constructor
. That's mostly because of the way that those classes are then shown in the templates. It's a lot easier to track down a class than many lone functions.
The YUI team and many in the community (myself included) seem to be moving away from @namespace
. It's hard to get right. Instead we're writing class names with dots in them, ie: @class Plugin.NodeMenuNav
.
Modules are meant in the YUI sense and can be mostly understood as "scripts" that contain one or more classes.
So a typical module will look like this:
/**
A series of utilities to do stuff
@module Stuff
**/
/**
A class that does foo very well
@class Foo
@constructor
@param {Object} [config] Configuration object
@param {Boolean} [config.jumpHigh] Whether foo should jump really high
**/
function Foo(config) {
config = config || {};
var high = config.jumpHigh;
}
/**
@method jump
@chainable
**/
Foo.prototype.jump = function () {
// jump
return this;
};
/**
A series of utilities to make Foo do more stuff
@class FooUtils
**/
var FooUtils = {
/**
@method doSomeStuff
@static
**/
doSomeStuff: function () {
}
};
Finally, @for
is meant for modules that extend other modules. For instance, you could have a module Bar that adds methods to the prototype of Foo:
/**
Adds extra functionality to Foo
@module Bar
**/
/**
Run really fast
@method run
@for Foo
**/
Foo.prototype.run = function () {};bv