jsdoc

jsdoc: multiline description @property

你说的曾经没有我的故事 提交于 2019-12-01 20:51:46
问题 I am documenting my code using jsdoc, so far so good, I have a comment like below ... * @property {string} mode - mode of display 'video' - display video or 'audio' - play only the audio. * @property... and it comes in html document like | ... | | | mode | string | mode of display 'video' - display video or 'audio' - play only the audio.| | ... | | I want it to appear something like | ... | | | | mode | string | mode of display | | | | 'video' - display video | | | | 'audio' - play only the

How to document deconstructed parameters with JsDoc

筅森魡賤 提交于 2019-12-01 16:34:56
How do I document a function parameter that gets deconstructed in function arguments? /** * Function deconstructs argument and do stuff. * @param {} *** what should i do here? *** */ function someFunction({ key1, key2, key3 }) { // do function stuffs } From the @param wiki page : If a parameter is destructured without an explicit name, you can give the object an appropriate one and document its properties. Documenting a destructuring parameter /** * Assign the project to an employee. * @param {Object} employee - The employee who is responsible for the project. * @param {string} employee.name -

Komodo Edit autocompletion JS object literal

雨燕双飞 提交于 2019-12-01 11:42:50
The problem is Komodo intelli-sense doesn't see object methods defined this way: var App = window.App || { method: function() { ... } } Typing "App." gives no result. However, defining an object like below works fine: var App = { method: function(){ } } How to make autocompletion working at first example pattern? Paul Sweatte Komodo has a macro API which can automate switching between the two patterns. Use the Add macro context menu option to create a new macro and paste the following code: komodo.assertMacroVersion(2); if (komodo.view && komodo.view.scintilla) { komodo.view.scintilla.focus();

Default “Home” text and content for JSDoc

主宰稳场 提交于 2019-12-01 02:51:56
After running a basic JSDoc compile/render from Node.js: jsdoc file1.js file2.js I get a well-formatted document using the default template inside a directory "out". Almost all is as expected! But when opening the document, it always says "Home" on the index.html page, has no content on that initial page, and has "Home" in the sidebar navigation. How and where do I notate the name of the project so that it replaces "Home"? I would also like to see a project description, as well as author and copyright information. It seems like the most basic of things to do in a JSDoc, but I can't find the

Default “Home” text and content for JSDoc

柔情痞子 提交于 2019-11-30 21:46:21
问题 After running a basic JSDoc compile/render from Node.js: jsdoc file1.js file2.js I get a well-formatted document using the default template inside a directory "out". Almost all is as expected! But when opening the document, it always says "Home" on the index.html page, has no content on that initial page, and has "Home" in the sidebar navigation. How and where do I notate the name of the project so that it replaces "Home"? I would also like to see a project description, as well as author and

How to document resolved values of JavaScript promises

那年仲夏 提交于 2019-11-30 20:06:00
Given this code : function asyncFoo() { return new Promise(function (fulfill, reject) { doAsyncStuff(function(err, data) { if(err) reject(new Error(err)); else fulfill(new Bar(data)); }); }); } How can I document that asyncFoo will return a Promise that, when fulfilled will yield an instance of Bar , and when rejected will yield an instance of Error ? /** * @return << Here, what do I have to write? >> */ function asyncFoo() { ... } Ethan B Martin Looks like you should do the following, based on some other source code's comments . /** * @return {Promise.<Bar>} */ How JavaScript Promises are

Creating a namespace-like organization in a google apps script library

醉酒当歌 提交于 2019-11-30 19:18:23
I was looking into building a toolset using google apps script. The problem with this is that as far as I can tell in only allows one level of organization. You can create a Library called Stopwatch and call methods Stopwatch.start() and Stopwatch.stop() which is pretty cool. What I had in mind though was something more like Utils.Stopwatch().start() and Utils.Timer.start() etc. I think it's certainly possible in javascript, but in order to keep breaking Apps Script autocomplete function it needs to be added in a certain format. Below is example an example of doing it wrong (gives an error)

How do you document an array of objects as a parameter in JSDoc?

为君一笑 提交于 2019-11-30 11:48:21
I have an array that looks like this: [{ "name": "c917379", "email": "jim@bmw.de" }, { "name": "c917389", "email": "jane@bmw.de" }] It is an array of arbitrary length with a number of repeating fields ( I've reduced this to two fields for clarity ). This gets passed into a JavaScript method. /** * @param {?} data */ update: function(data) {...} I was wondering how you would document this in JSDoc. Ie. how would you document the type where the question mark is? I just figured out the answer to my question : It would look like this : /** * * @param {{name:string, email:string}[]} * */ In JSDoc

How to document a function returned by a function using JSDoc

China☆狼群 提交于 2019-11-30 11:15:20
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'); You can document the inner function and then reference it like so /** * @param {Number} - number of times to prompt * @return {many_prompts~inner

How do you document JSDoc with mixed parameter type?

和自甴很熟 提交于 2019-11-30 10:55:41
How do I document a method in JavaScript using JSDoc when the parameter type can be mixed? I have method on a Dialog object where I can show HTML or my own Viewable objects. The method JSDoc looks like this: /** * Can pass in viewable object, or some HTML element * * @param viewable viewable {Viewable} or HTML element {HTMLElement} or String {string} * @param {Boolean} cancelable is cancellable * @param title string or data object of String and Id {Title:String, Id:String} for setting HTML id value * @param {Array} actions array of functions actions display buttons on the bottom connecting to