I'm trying to document a class in an AMD JavaScript module using JSDoc 3. Here's my code, based on the example in the documentation here:
/**
* A module representing a jacket.
* @module my/jacket
*/
define('my/jacket', function() {
/**
* @class
* @alias module:my/jacket
*/
function Jacket() {
}
/**
* Open and close your Jacket.
*/
Jacket.prototype.zip = function() {
};
return Jacket;
});
The output this produces looks like this:
Class: module:my/jacket
module:my/jacket
new module:my/jacket()
but I'd like it to read:
Class: Jacket
Jacket
new Jacket()
Is there a way to do this? I'm using jsdoc 3.4.1.
I've tried changing @class
to @class Jacket
, which almost works: the class appears with the right name, but the documentation of the zip
method is not generated.
The solution was to set the class (function) name using the @alias
tag instead of the module name:
/**
* A module representing a jacket.
* @module my/jacket
*/
define('my/jacket', function() {
/**
* @class
* @alias Jacket
*/
function Jacket() {
}
/**
* Open and close your Jacket.
*/
Jacket.prototype.zip = function() {
};
return Jacket;
});
This produces the desired output:
Class: Jacket
Jacket
new module:Jacket()
together with the zip
method documentation.