jsdoc

How to jsdoc annotate BackboneJS code?

你。 提交于 2019-12-17 21:57:32
问题 Has anyone ever documented BackboneJS code with JSDoc? I'm having problems annotating Backbone constructs such as: User = Backbone.Model.extend({ defaults: { a: 1 }, initialize: function () { // ... }, doSomething: function (p) { // ... } }); Any advice appreciated. Thanks. 回答1: I think it works somehow like this, if you're talking about the JSDoc Toolkit: User = Backbone.Model.extend( /** @lends User.prototype */ { /** * @class User class description * * @augments Backbone.Model *

How to specify an array of objects as a parameter or return value in JSDoc?

◇◆丶佛笑我妖孽 提交于 2019-12-17 17:32:19
问题 In JSDoc, the best documentation I can find shows to use the following if you have an array of a specific type (such as an array of strings) as: /** * @param {Array.<string>} myStrings All my awesome strings */ function blah(myStrings){ //stuff here... } How would you replace the below question marks specify an array of objects? /** * @param {???????} myObjects All of my equally awesome objects */ function blah(myObjects){ //stuff here... } 回答1: You should be more specific what you mean by

JSDoc Object of templated objects

我的梦境 提交于 2019-12-14 00:54:59
问题 Is there a way to loosely specify what type of objects should be inside the object you're documenting? I'm looking to document an object of the following: var obj = { unknownName1: { name: "KnownValue" }, unknownName2: { name: "KnownValue", offset: { x: 0, y: 0 } }, unknownName3: { name: "KnownValue", offset: { x: 0, y: 0 }, visible: true }, unknownName4: { name: "KnownValue" } }; The sub objects should have the following properties: /** * Example Object * @typedef myObject * @type {Object} *

How to generate HTML for JSDoc

让人想犯罪 __ 提交于 2019-12-13 14:09:56
问题 I'd like to create an auto generating JSDoc documentation file for a framework I'm building but can't seem to find a way to output the documentation. Is it possible to output the doc to JSON or HTML? Or will I have to build my own JSDoc parser with RegExp? I've looked all over the web and can't find anything on the subject. Thank you. 回答1: A big thanks to Felix Kling for pointing me the official documentation: usejsdoc.com The documentation has been moved to https://jsdoc.app/ 来源: https:/

What do you call an object with function(s) in it

≯℡__Kan透↙ 提交于 2019-12-13 07:41:50
问题 What do you call an object with a function in it. I'm documenting some functions that return this with jsdoc and I'm having trouble sticking with one way of conveying this. This is what I'm returning {fnName: [function]} or {fnNameA: [function], fnNameB: [function]} My problem documenting the return value this way is conveying not to expect property as literal object.fnName and as a variable function name. How do I represent this in jsdocs? Is the above the standard? What do we as programmers

How do you include a dot in names/events/callbacks with jsDoc?

蹲街弑〆低调 提交于 2019-12-12 12:22:52
问题 The documentation for namepaths says you should escape special characters: Above is an example of a namespace with "unusual" characters in its member names (the hash character, dashes, even quotes). To refer to these you just need quote the names: chat."#channel", chat."#channel"."op:announce-motd", and so on. Internal quotes in names should be escaped with backslashes: chat."#channel"."say-\"hello\"" However, this doesn't work on dots. If I have an event called "cellClick.dt" that I want to

How to JsDoc multiple inheritance or mixins?

妖精的绣舞 提交于 2019-12-12 11:06:10
问题 How do I document mixins or multiple inheritance? /** * @class Parent */ function Parent() { } Parent.prototype.parentTest = 5; /** * @class Mixin */ function Mixin() { } Mixin.prototype.mixinTest = 5; /** * @class Child * @augments Parent * @mixin Mixin */ function Child() { } Is there anything official from JsDoc? If not then how would you prefer it to be written? 回答1: Multiple @augments are actually supported by the JsDoc Toolkit (I haven't tried, but their unit tests suggest so, search

JS头部注释规范

坚强是说给别人听的谎言 提交于 2019-12-12 10:56:14
常用参数: @param @argument 指定参数名和说明来描述一个函数参数 @returns 描述函数的返回值 @author 指示代码的作者 @deprecated 指示一个函数已经废弃,而且在将来的代码版本中将彻底删除。要避免使用这段代码 @see 创建一个HTML链接,指向指定类的描述 @version 指定发布版本 @requires 创建一个HTML链接,指向这个类所需的指定类 @throws @exception 描述函数可能抛出的异常的类型 {@link} 创建一个HTML链接,指向指定的类。这与@see很类似,但{@link}能嵌在注释文本中 @fileoverview 这是一个特殊的标记。如果在文件的第一个文档块中使用这个标记,则指定该文档块的余下部分将用来提供这个文件的概述 @class 提供类的有关信息,用在构造函数的文档中 @constructor 明确一个函数是某个类的构造函数 @type 指定函数的返回类型 @extends 指示一个类派生了另一个类。JSDoc通常自己就可以检测出这种信息,不过,在某些情况下则必须使用这个标记 @private 指示一个类或函数是私有的。私有类和函数不会出现在HTML文档中,除非运行JSDoc时提供了–private命令行选项 @final 指示一个值是常量值。要记住JavaScript无法真正保证一个值是常量

JsDoc toolkit and Namespace - Warning trying to .. without

非 Y 不嫁゛ 提交于 2019-12-12 04:31:45
问题 I am using jsdoc-toolkit with the namespace library of Mike Koss. The code looks like this namespace.module('a.b', // this is the namespace // @param {Object} exports visible classes within this namespace // @param {function} required other namespaces function (exports, require) { var entityBase = require("a.base"); var util = require("a.util"); // @class BlaBla // @constructor // @property {String} .. // @property {String} .. // @property {String} .. // @property {..} .... // @param {Array}

How to include an already documented method in jsdoc-toolkit?

≡放荡痞女 提交于 2019-12-12 01:33:37
问题 I have a JavaScript singleton object created with closure method: /** * This is the singleton. * * @namespace window.Something.Singleton */ window.Something.Singleton = (function() { /** * Foo method. * * @return {String} this method always returns with <code>bar</code> */ function _foo() { return "bar"; } /** * @lends window.Something.Singleton# */ return { /** * @borrows window.Something-_foo * @function */ foo: _foo }; }()); But the jsdoc-toolkit does not generate the inherited