jsdoc

JSDoc - mark some code to not be parsed but retain documentation?

半世苍凉 提交于 2019-12-07 04:31:13
问题 I'm trying to document a Javascript file with JSDoc(3) like so: /** 1 if gnome-bluetooth is available, 0 otherwise * @type {boolean} * @const */ const HAVE_BLUETOOTH = @HAVE_BLUETOOTH@; Now the file (called config.js.in ) is not on its own valid Javascript; the file gets run through a Makefile which substitutes an appropriate value for @HAVE_BLUETOOTH@ . When I try to run JSdoc on this, it (understandably) balks because of the syntax error in the file. Is there some way to tell JSDoc to

How to add and use a tag on jsdoc?

穿精又带淫゛_ 提交于 2019-12-07 04:07:08
问题 I am trying to add a customTag to jsdoc. I have created a file in the plugins directory like this: method.js exports.defineTags = function(dictionary) { dictionary.defineTag("methodHttp", { mustHaveValue: true, canHaveType: false, canHaveName: true, onTagged: function(doclet, tag) { doclet.methodHttp = tag.value; } }); }; Then I added to my conf.json : { "tags": { "allowUnknownTags": true }, "source": { "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" }, "plugins": [

How to document an event emitter returned

╄→гoц情女王★ 提交于 2019-12-07 04:00:36
问题 How to document the events emitted by stream returned in MyFunc() with JSDoc? /** * [MyFunc description] * @param {Object} opts - [description] * @return {Stream} - [description] */ function MyFunc (opts) { // stream is an EventEmitter var stream = new MyEventEmitter(); stream.emit('event1', ... ); stream.emit('event2', ... ); return stream; } 回答1: You can document these behaviors by documenting your events ( event1 , event2 , ...) as @event MyFunc#event1 and MyFunc, or whoever does the

JSDoc: What is a relationship between modules and namespaces

喜夏-厌秋 提交于 2019-12-07 02:28:37
问题 I faced a problem with understanding the purpose of namespaces and modules in a union. For example I have a class Game.utils.Matrix . I want to annotate Game as a namespace, utils as a module and Matrix as a class: /** * @namespace Game */ /** * @module utils * @memberOf Game */ /** * Create a matrix * @constructor */ function Matrix(){} It creates a documentation and the name path of the Matrix class is Game.utils~ Matrix , but if I follow the Module link its name path is Module: utils

The error message “There are no input files to process” from jsdoc

不问归期 提交于 2019-12-07 01:54:14
问题 Jsdoc is installed locally ( npm install jsdoc ). I get the following error while trying to execute .\node_modules.bin\jsdoc --debug ./lib/JavaScriptSource.js Output: 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":{"_":[".

JsDoc: How do I document that an object can have arbritrary (unknown) properties but with a particular type?

爷,独闯天下 提交于 2019-12-06 20:10:53
问题 This is a similar to question 30360391. I want to express that the parameter of a function is a plain JS object that can have arbitrary properties (with unknown) names but all properties are objects themselves with fixed properties. An example: The function is just like this /** * @param {Descriptor} desc */ function foo( desc ) { // ... } and a typical desc looks like desc = { unknownEntity1: { priority: 5; writable: false; }, unknownEntity2: { priority: 42; writable: true; }, unknownEntity3

Seeking: Example of how to use jsDoc with the Webstorm IDE (v 4)

倾然丶 夕夏残阳落幕 提交于 2019-12-06 11:16:46
问题 I'm still learning js and trying out the Webstorm IDE, which seems sweet (including jumping to var/function declarations). I can see how to get the template for a jsdoc comment to appear but I'm not experienced with it and looking for an example of how to provide more detail in the comment and how to view that detail. 回答1: WebStorm 4.0 supports most of JSDoc tags. For example, when you specify @type for variable, completion will work better and assignments of expressions with wrong types will

How to document a method with multiple aliases?

谁说我不能喝 提交于 2019-12-06 07:52:19
I'm trying to document the getName() method of The following Person constructor : Javascript code : /** * Creates a person instance. * @param {string} name The person's full name. * @constructor */ function Person( name ) { /** * Returns the person's full name. * @return {string} The current person's full name. */ function getName() { return name; } this.getName = getName; this.getN = getName; this.getFullName = getName; } As you can see, the getName() method has two aliases ( getN() and getFullName() ), so the obvious tag to use is the @alias tag, but unfortunately, it has two major problems

JSDoc3 documentation of a function's argument being an array of objects?

丶灬走出姿态 提交于 2019-12-06 07:14:24
UseJSDoc.org's page on @type explains how to document arrays and objects, but not arrays of objects. My function accepts an array of objects with a specific list of properties and it's these properties that I'd like to document. The function might look like function foo(people) and the people array might have been created by the caller of the function as arr = []; arr.push({name: "Alfred", profession: "Butler", hitpoints: 2}); arr.push({name: "Batman", profession: "Vigilante", hitpoints: 42}); // ... foo(arr) I'd like to use the {{name: string, profession: string, hitpoints: number}} Person

How To Use JSDOC3 To Document Enum Constants

丶灬走出姿态 提交于 2019-12-06 03:56:30
问题 We're using JSDOC to document our client-facing SDK and we're having difficult getting it to recognize our 'enums' (i.e. constants). Which tags should we use to get JSDOC to pick it up in the documentation? Here's a sample: /** * @module Enum */ export namespace { /** * @enum WidgetType {string} */ Enum.WidgetType = { /** Dashboard */ Dashboard: 'dashboard', /** Form */ Form: 'entityeditform', /** Report */ Report: 'report' }; } Here's how the 'enums' are used in code: app.widget({ id: