documenting constructors and config options

14 views
Skip to first unread message

Arthur K

unread,
Jun 30, 2009, 4:51:16 PM6/30/09
to ext-doc
Say I have a class written as such:

/**
* @class Foo.Bar
* The description for my class
* @namespace Foo
*/
Foo.Bar = function(configA, configB) {
/**
* @property
*/
this.myProperty = null;
...
};

What is the best way to document my constructor? Technically I haven't
written a method, so I'm not sure where the best place would be to
place documentation tags (same for config options).

Any advice?

oxymoron

unread,
Jul 1, 2009, 2:18:37 AM7/1/09
to ext-doc
In fact you've just found a defect. I'll try to explain...
To declare constructor and its parameters you have to use @constructor
tag as follows:

/**
* @class Foo.Bar
* The description for my class
* @namespace Foo
* @constructor
* @param {Object} configA This is my config
* @param {Object} configB This is another config
*/
Foo.Bar = function(configA, configB) {
/**
* @property
*/
this.myProperty = null;

/**
* @method
*/
this.myMethod = function(){};
};

Here you can see one more @method declaration.
The problem is - if you remove this @method - constructor docs will
not appear!

Try to do it. It would be good if you submit issue to the issue list.

Arthur K

unread,
Jul 2, 2009, 2:00:04 PM7/2/09
to ext-doc
Okay, so as long as there's one @method declared (which could be a
totally different method from the constructor) the constructor shows
up. If no methods are documented, the constructor doesn't show up.

I'll add as a bug. Thanks!
Reply all
Reply to author
Forward
0 new messages