Tag: jsdoc3

@type为node.js的“导出的模块”和良好的文档描述?

我正在努力成为一个好公民,并logging我的节点模块….但我不确定要在@type中放置什么。 我正在使用webstorm所以它会自动把@type {出口},但我有点困惑,我应该放在那里? 任何人都帮我一把吗? 这里是我正在开发的一个小模块,删除代码以更好地强调问题。 我很困惑我应该使用什么types,以及如何logging出口,并需要一个很好的描述。 是@type {exports}一个有效的标签? 任何人都知道一个很好的标准,或给他/她们将使用/或正在使用的东西 /** * A module for logging * @module logger * @type {exports} */ /** * HOW TO DOCUMENT THIS ???????????? GOOD DESCRIPTION?? * @type {exports} */ var winston = require('winston'); /** * Returns an instance of the logger object * @param module * @returns {exports.Logger} */ […]

如何在mixins上的extends / inherit情况下正确地为Node.js模块定义JSDoc

我有三个Node.js模块。 一个被调用的user从base模块获得inheritance。 handler模块与user一个实例交互: 基本模块 – 获得inheritance: /** * Base module */ 'use strict'; const _ = require("underscore"); module.exports = { name: "base", /** * Extent object helper */ extend: function(child) { return _.extend({}, this, child); }, /** * Delegate event method */ delegate: function () { //some delegate event } }; 用户模块 – 像一个模型: /** […]

jsdoc3中事件标记的工作示例

有人可以给我一个关于如何正确使用@event标签的例子。 我已经看了这里的jsdoc3文档: http ://usejsdoc.org/tags-event.html,但我无法得到它的工作。 我正在使用nodejs,并在MyClass / index.js中有一个模块,它通过MyClass的名称导出构造函数: module.exports = MyClass; myClass = function () { … }; 我试图添加 /** * Snowball event. * @event MyClass#snowball */ 在编译的文档中, snowball出现在全局事件列表中,但是当我点击它时,它告诉我 The requested URL /{path-to-my-docs}/MyClass.html was not found on this server. 提前致谢。

返回的类实例的JSDoctypes

我使用Node.js有两个模块和一个依赖于它们的脚本: LIB / Bar.js module.exports = class Bar { // .. }; LIB / Foo.js const Bar = require('./Bar.js'); module.exports = class Foo { /** * @return {Bar} A Bar instance */ get someBar() { return new Bar(); } }; main.js const Foo = require('./lib/Foo.js'); checkFoo(new Foo()); /** * @param {Foo} foo A Foo instance […]

来自jsdoc的错误消息“没有要处理的input文件”

Jsdoc在本地安装(npm install jsdoc)。 在尝试执行时出现以下错误: .\node_modules.bin\jsdoc –debug ./lib/JavaScriptSource.js输出: DEBUG: JSDoc 3.3.0-dev (Sun, 15 Jun 2014 18:39:52 GMT) DEBUG: Environment info: {"env":{"conf":{"tags":{"allowUnknownTags":true},"templ ates":{"monospaceLinks":false,"cleverLinks":false,"default":{"outputSourceFiles" :true}},"source":{"includePattern":".+\.js(doc)?$","excludePattern":"(^|\/|\\ )_"},"plugins":[]},"opts":{"_":["./lib/JavaScriptSource.js"],"debug":true,"destina tion":"./out/","encoding":"utf8"}}} There are no input files to process. JSDoc 3.3.0-dev(Sun,2014年6月15日18:39:52 GMT) 选项: -t,–template <value>要使用的模板的path。 默认: path/到/ jsdoc /模板/默认 -c,–configure <value>configuration文件的path。 默认:path / to / jsdoc / conf.json ….. </代码>

JSDocs:loggingNode.jsexpression路由

我很努力logging与JSDocs的router.get调用。 我无法获得文档正确显示在页面上,如果我尝试将其附加到我的路由器调用本身。 /** * Health check * @memberof health */ router.get('/happy', function(req, res) { res.json({ "status" : "OK" }); }); 为了解决这个问题,我让function有了名字。 router.get('/happy', happy); /** * Health check * @memberof health */ function happy(req, res) { res.json({ "status" : "OK" }); } 这工作,但我真的想find一种方法来获得第一个方法的工作。 有没有办法logging第一个例子? 我可以使用的关键字?

直接从源代码生成JavaScript文档

我正在寻找一种工具来生成JavaScript函数和属性的文档,即使没有与这些函数或属性(如Doxygen)相关的适当格式的注释块。 JSDoc和其他一些文档工具之间的比较提到,JSDoc可以parsing源代码来生成文档,即使没有注释块(就像我上面提到的Doxygen一样)。 他们说所有其他工具只parsing注释块。 我根据这个指令从npm(在节点上)安装了JSDoc 3.3.0-alpha4,我试图为我的项目生成文档。 据我所见JSDoc不会生成任何文档的function或属性,没有正确的注释与相关的JSDoc标志。 我知道JSDoc已经经历了很多迭代,这个function已经被删除,或者我没有使用正确的开关? 我试图检查命令行选项,但找不到任何开关。 我只是这样使用它: ./node_modules/.bin/jsdoc -r -l my_project –destination doc/ 我知道还有其他工具可以自动添加文档块的代码,例如smartcomments ,但它不是我正在寻找的。 任何人都可以对此有所了解吗?

jsdoc正确的方式来loggingsocket.on('event',function(){})和路由处理程序

如何使用具有以下格式的jsdoc来loggingAPI(单个文件) // api.js exports.addSocketEvents = function(socket) { /** * This will do that and … * @param {Object} data Some data * @param {string} data.bla Something about bla * @param {number} data.n Some number */ socket.on('something_1', function(data) { … }); /** * Another function that will do .. * @param {string} id of something */ […]

用jsdocloggingcallback的正确方法是什么?

我花了很长一段时间在互联网上寻找最好的方式来正确loggingjsdoc的callback,但不幸的是,我还没有find一个好的方法。 这是我的问题: 我正在为开发人员编写一个Node.js库。 这个库提供了开发人员将要使用的多个类,函数和方法。 为了使我的代码清晰易懂,以及(希望)将来会自动生成一些API文档,我已经开始在代码中使用jsdoc来自我logging正在发生的事情。 比方说,我定义了一个如下的函数: function addStuff(x, y, callback) { callback(x+y); }); 使用jsdoc,我目前正在logging这个函数,如下所示: /** * Add two numbers together, then pass the results to a callback function. * * @function addStuff * @param {int} x – An integer. * @param {int} y – An integer. * @param {function} callback – A callback to run […]