jsdoc3

What's the proper way to document callbacks with jsdoc?

不打扰是莪最后的温柔 提交于 2019-11-29 22:38:58
I've spent quite a while scouring the internet looking for the best way to properly document callbacks with jsdoc, but unfortunately, I haven't found a great one yet. Here's my question: I'm writing a Node.js library for developers. This library provides multiple classes, functions, and methods that developers will be working with. In order to make my code clear and understandable, as well as to (hopefully) auto-generate some API documentation in the future, I've started using jsdoc in my code to self-document what's happening. Let's say I define a function like the following: function

How do I JSDoc A Nested Object's Methods?

喜欢而已 提交于 2019-11-29 19:58:09
I've been trying to use JSDoc3 to generate documentation on a file, but I'm having some difficulty. The file (which is a Require.js module) basically looks like this: define([], function() { /* * @exports mystuff/foo */ var foo = { /** * @member */ bar: { /** * @method */ baz: function() { /*...*/ } } }; return foo; } The problem is, I can't get baz to show up in the generated documentation. Instead I just get a documentation file for a foo/foo module, which lists a bar member, but bar has no baz (just a link to foo 's source code). I've tried changing bar 's directive to @property instead,

JSDoc: Return object structure

删除回忆录丶 提交于 2019-11-29 18:58:32
How can I tell JSDoc about the structure of an object that is returned. I have found the @return {{field1: type, field2: type, ...}} description syntax and tried it: /** * Returns a coordinate from a given mouse or touch event * @param {TouchEvent|MouseEvent|jQuery.Event} e * A valid mouse or touch event or a jQuery event wrapping such an * event. * @param {string} [type="page"] * A string representing the type of location that should be * returned. Can be either "page", "client" or "screen". * @return {{x: Number, y: Number}} * The location of the event */ var getEventLocation = function(e,

How do I JSDoc A Nested Object's Methods?

纵然是瞬间 提交于 2019-11-28 15:46:35
问题 I've been trying to use JSDoc3 to generate documentation on a file, but I'm having some difficulty. The file (which is a Require.js module) basically looks like this: define([], function() { /* * @exports mystuff/foo */ var foo = { /** * @member */ bar: { /** * @method */ baz: function() { /*...*/ } } }; return foo; } The problem is, I can't get baz to show up in the generated documentation. Instead I just get a documentation file for a foo/foo module, which lists a bar member, but bar has no

JSDoc with AngularJS

别说谁变了你拦得住时间么 提交于 2019-11-28 15:29:02
Currently within my Project we are using JSDoc, we have recently started to implement Angular and I want to continue using JSDoc to ensure that all the documentation is within the same place. I have taken a look at people mainly just saying to use ngDoc but this isn't really a viable option as we will always have separate JavaScript and I ideally would have everything together. /** * @author Example <jon.doe@example.com> * @copyright 2014 Example Ltd. All rights reserved. */ (function () { window.example = window.example || {}; /** * Example Namespace * @memberOf example * @namespace example

How to document a function returned by a function using JSDoc

断了今生、忘了曾经 提交于 2019-11-27 17:16:52
问题 I am using JSDoc for parameter documentation. It is clear how to document the parameter types for many_prompts , but what is the right way to document the function it returns? /** * @param {Number} - number of times to prompt * @return {Function(prompt{Number})} - the returned function */ function many_prompts(count) { return function(prompt) { for(var i=0; i < count; i++) alert(prompt); } } //Example of use: var y =many_prompts(3); y('Hello World'); 回答1: You can document the inner function

JSDoc with AngularJS

一世执手 提交于 2019-11-27 09:14:21
问题 Currently within my Project we are using JSDoc, we have recently started to implement Angular and I want to continue using JSDoc to ensure that all the documentation is within the same place. I have taken a look at people mainly just saying to use ngDoc but this isn't really a viable option as we will always have separate JavaScript and I ideally would have everything together. /** * @author Example <jon.doe@example.com> * @copyright 2014 Example Ltd. All rights reserved. */ (function () {