Riko Nagatama
Riko Nagatama

Reputation: 388

Documenting prototype property and method with JSDoc-3.3.0-alpha5

I have a class named FileDownloader and I've tried documenting it, but the properties and method declared using prototype aren't generated in the output file.

As stated on the title, I use jsdoc 3.3.0-alpha5.

Here's the code:

/**
 * @class
 * @memberOf module:utils
 */
FileDownloader = function() {};    
/**
 * @type {Boolean}
 */
FileDownloader.prototype.overwrite = false;
/**
 * @type {String}
 */
FileDownloader.prototype.dir = config.dealImagePath;    
/**
 * @param {String} url
 * @param {Function} done
 * @param {Object} done.err
 * @param {String} done.file
 */
FileDownloader.prototype.download = function(url, done) {
    //...
};

Here is the generated document:

new FileDownloader()
    | Source: path/to/file.js

Any idea?

Upvotes: 4

Views: 1743

Answers (1)

Wiki
Wiki

Reputation: 351

The reason is memberOf in FileDownloader description. You should set module before, all symbols in the file are assumed to be members of the module. http://usejsdoc.org/tags-module.html

Like this

/** @module utils */

/**
 * @class
 */
var FileDownloader = function() {};

/**
 * @type {Boolean}
 */
FileDownloader.prototype.overwrite = false;
...

Upvotes: 1

Related Questions