Doc Object as though it was a class

23 views
Skip to first unread message

bxgrant

unread,
Feb 26, 2012, 4:48:40 AM2/26/12
to JSDoc Users
I'm using JSDoc 3. I've got a commonJS module that exports a create
function. The create function creates a new object and attaches
members and methods to it and then returns the new object. The same
object "type" is returned every time. I can't figure out how to get
it documented correctly as though it were a class being returned and I
don't want to use the "new" keyword approach to OO. I prefer the
method below where I create a simple object and attach the members and
methods to it.

Here's what I've got.

/**
* @module acme/Manager
* @desc Defines an acme manager.
*/

/**
* A factory method for creating managers.
* @return {Manager}
*/
exports.create = function()
{
/**
* Defines a manager class.
* @class
*/
var Manager = {};

/**
* @type {Number} The number hired.
*/
Manager.numHired = 0;

/**
* This method hires someone.
*/
Manager.hireSomeone = function()
{
};

return Manager;
};

When I generate the doc, we have two problems. The first problem is
that while the class is generated, its members and methods aren't.

If I take the Manager "class" and stick it in its own file without
putting it in the "create" function, then the class is generated and
its members and methods are found but they are marked static.

Any help would be greatly appreciated.
Reply all
Reply to author
Forward
0 new messages