jsdoc

How to preview jsdoc comments in google doc scripts

匿名 (未验证) 提交于 2019-12-03 01:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I know that Issue 1731 has been raised requesting preview of jsdoc within the Google script editor. http://code.google.com/p/google-apps-script-issues/issues/detail?id=1731 While we wait for that to be implemented, what's the best way to preview jsdoc comments that I'm adding to my published library, without requiring me to create a new version? 回答1: Update 2014: With libraries now supported by the Google Apps Script editor's autocompletion, it's possible to get immediate feedback about SOME of your library's jsdoc comments. This solution

How to specify resolution and rejection type of the promise in JSDoc?

风流意气都作罢 提交于 2019-12-03 01:33:42
问题 I have some code that returns a promise object, e.g. using Q library for NodeJS. var Q = require('q'); /** * @returns ??? */ function task(err) { return err? Q.reject(new Error('Some error')) : Q.resolve('Some result'); } How to document such a return value using JSDoc? 回答1: Even if they don't exist in Javascript, I found that JSdoc understands "generic types". So you can define your custom types and then use /* @return Promise<MyType> */ . The following result in a nice TokenConsume(token) →

VS Code Disable JSDoc Comment Coloring

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to disable multicolored JSDoc comments in Visual Studio Code. Currently, the JSDoc comments look like this ('@param', etc. is colored something other than the default comment color): JSDoc Highlighted Comment I want the entire comment to be the same default grey color. I tried disabling all extensions and custom user settings, but that didn't affect the JSDoc highlighting. Does anyone know what settings I need to change to fix this? I thought either workbench.colorCustomizations or editor.tokenColorCustomizations would have the

JSDoc typedef in a separate file

≡放荡痞女 提交于 2019-12-02 22:26:20
Can I define all custom types in a separate file (e.g. types.jsdoc ), so that they can be reused throughout the application? What's the right way to do it? /** * 2d coordinates. * @typedef {Object} Coordinates * @property {Number} x - Coordinate x. * @property {Number} y - Coordinate y. */ I just tried with VSCode and it works only if the separate file is opened in the editor. If not, external typedefs are typed as any You can define types in a module (eg. typedefs.js ). The module contains your JSDoc typdefs and can simply export an unused property. // typedefs.js /** * @typdef foo *

Why Doesn't jQuery use JSDoc? [closed]

一曲冷凌霜 提交于 2019-12-02 20:14:00
Or do they and it's just not in the source? I'd really like to get something that will stop js-doc-toolkit from freaking out each time it parses jQuery. It also means I can't properly document any code using jQuery as a dependency without at least putting some boilerplate js-doc blocks, which fail to properly document jQuery's structure. Is there a common solution I'm not aware of? I have tried googling, btw. Nick Craver I'll take a shot in the dark here since I can't speak for the jQuery team of why I wouldn't use JSDoc. JSDoc, at least the last time I checked, didn't have any clean way to

How to document a Require.js (AMD) Modul with jsdoc 3 or jsdoc?

随声附和 提交于 2019-12-02 18:02:03
I have 2 types of Modules: Require.js Main File : require.config({ baseUrl: "/another/path", paths: { "some": "some/v1.0" }, waitSeconds: 15, locale: "fr-fr" }); require( ["some/module", "my/module", "a.js", "b.js"], function(someModule, myModule) { } ); Mediator Pattern: define([], function(Mediator){ var channels = {}; if (!Mediator) Mediator = {}; Mediator.subscribe = function (channel, subscription) { if (!channels[channel]) channels[channel] = []; channels[channel].push(subscription); }; Mediator.publish = function (channel) { if (!channels[channel]) return; var args = [].slice.call

How to specify resolution and rejection type of the promise in JSDoc?

跟風遠走 提交于 2019-12-02 15:02:19
I have some code that returns a promise object, e.g. using Q library for NodeJS. var Q = require('q'); /** * @returns ??? */ function task(err) { return err? Q.reject(new Error('Some error')) : Q.resolve('Some result'); } How to document such a return value using JSDoc? Even if they don't exist in Javascript, I found that JSdoc understands "generic types". So you can define your custom types and then use /* @return Promise<MyType> */ . The following result in a nice TokenConsume(token) → {Promise.<Token>} with a link to your custom Token type in the doc. /** * @typedef Token * @property {bool}

How to indicate param is optional using inline JSDoc?

我们两清 提交于 2019-12-02 14:34:02
According to the JSDoc wiki for @param you can indicate a @param is optional using /** @param {String} [name] */ function getPerson(name) { } and you can indicate a param inline using function getPerson(/**String*/ name) { } And I can combine them like the following, which works ok. /** @param [name] */ function getPerson(/**String*/name) { } But I would like to know if there is a way to do it all inline if possible. From official documentation : Optional parameter An optional parameter named foo. @param {number} [foo] // or: @param {number=} foo An optional parameter foo with default value 1.

Document overloaded function in JSDoc

我怕爱的太早我们不能终老 提交于 2019-12-02 10:44:22
问题 I have an overloaded toggle function and want to document the behaviors w/ JSDoc. If the value is defined the window state is set to the boolean value of the truthy parameter, if undefined the window state toggles. I'm looking for something like this. /** * Set the map window in mobile * @param {undefined|*} on - toggle or set the window state * - {undefined} toggles window state * - {*} set window state */ toggleWindow(on) { if (on === undefined) { on = !this.state.window; } this.setState({

JSDoc for showing optional arguments in Google Sheets autocomplete dropdown

眉间皱痕 提交于 2019-12-02 03:12:36
I'd like to document (in the Google Sheet autocomplete) a custom function with optional arguments, similar to the WEEKDAY function (autocomplete below). The JSDoc spec on optional arguments does not work. Google does not seem to document this anywhere. How can I create a function with the same visual treatment (both in the argument description and the Example) that Google has? /** * Summary of function * @param {"example"} arg Argument description * @param {"optional"} opt_arg This argument is optional * @return {String} Return value description * @customfunction */ function JSDOC(arg, opt_arg