简体   繁体   English

使用JSDoc-3.3.0-alpha5记录原型属性和方法

[英]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. 我有一个名为FileDownloader的类,我已经尝试过记录它,但是在输出文件中没有生成使用prototype声明的属性和方法。

As stated on the title, I use jsdoc 3.3.0-alpha5. 如标题所述,我使用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? 任何想法?

The reason is memberOf in FileDownloader description. 原因是FileDownloader描述中的memberOf You should set module before, all symbols in the file are assumed to be members of the module. 您应该先设置模块,假定文件中的所有符号都是模块的成员。 http://usejsdoc.org/tags-module.html http://usejsdoc.org/tags-module.html

Like this 像这样

/** @module utils */

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM