jsdoc

How can I document a type in webstorm using just jsdoc?

梦想与她 提交于 2019-12-18 12:19:25
问题 When I write the following code, the annotator tells me that BrowserSelector is not defined in the second typedef: /** * @typedef {{name: String, minVer: Number, maxVer: Number}} BrowserSelector */ /** * @typedef {{type:String, browser: BrowserSelector, attribute: Object}} Selector */ I believe it is not associating the type with the name. How can I do that? I would prefer not to add actual code for it, just jsdoc comments. 回答1: I'm using this comment style for 'struct' like types: /** *

How can I view the outline in eclipse when using the revealing module pattern?

邮差的信 提交于 2019-12-18 11:26:43
问题 I'm currently refactoring some Javascript code we have and amongst other things I've changed it to make use of the revealing module pattern. The code is looking much tidier and it works fine but I can't see the functions anymore in the outline view. I see the top level namespace var as a var but you can't expand it to see the functions within. Lets say the code used to look like this: function myFunc1() {} function myFunc2() {} In this case you see both functions in the outline view. But if

Google Closure Compiler 100% typed

China☆狼群 提交于 2019-12-18 11:12:28
问题 How can I get my application to be 100% typed in regard to google closure compiler? I already tagged everything with jsdoc comments. Is it even possible to get 100? I'm at 64,6% 回答1: It IS possible to achieve 100%. My own projects are 100% typed. The closure compiler can output warnings about expressions with unknown types. Unfortunately there is no command line option to enable this feature. You have to modify the source code to enable it: Download the current sources: git clone https://code

JSDoc: Return object structure

▼魔方 西西 提交于 2019-12-18 09:59:10
问题 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".

JSDoc: Return object structure

会有一股神秘感。 提交于 2019-12-18 09:58:56
问题 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".

Writing jsdoc documentation on methods inside a class

纵饮孤独 提交于 2019-12-18 09:03:28
问题 I am writing some libraries in Google Apps Script and I am trying to document them. I have written some classes in the format below, and the comments of methods inside the class don't show up in the documentation : /** * My comments here */ function MyBeautifulObject(){ this.myMethod=myMethod; .... /** * This comment doesn't show up */ function myMethod(){ ... } } Any idea on how I could achieve this ? 回答1: This question may be a duplicate... this answer certainly is. The jsdoc variant

How to document deconstructed parameters with JsDoc

荒凉一梦 提交于 2019-12-18 08:09:38
问题 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 } 回答1: 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. *

How do I document AMD + Backbone project with JSDoc3

情到浓时终转凉″ 提交于 2019-12-18 05:56:29
问题 I have a Backbone boilerplate based project, that I want to document with recent jdoc-toolkit Though I can't get it to generate anything but empty _global class Code sample: /** * This is a root model for DLClass * @module models/DLClass */ define([ 'underscore', 'backbone' ], /** @lends DLClass */ function (_, Backbone) { /** * This is a root model for DLClass * @class DLClass * @constructor * @return Session Object */ var DLModel = Backbone.Model.extend({ /** @lends DLClass.prototype */ /**

Document generic type parameters in JSDOC

寵の児 提交于 2019-12-18 05:43:10
问题 In JSDoc there exists the possibility to document the exact types of array contents like this: /** @param {Array.<MyClass>} myClasses An array of MyClass objects. */ TestClass.protoype.someMethod = function( myClasses ){ myClasses[0].aMethodOnMyClass(); } This makes code completion in IDEs like WebStorm actually provide the right type information after the [0]. . This works well for the Array type, however I have my own collection types where I would like to make use of this feature, too. The

Best way to document anonymous objects and functions with jsdoc [closed]

亡梦爱人 提交于 2019-12-17 23:19:30
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year . Edit: This is technically a 2 part question. I've chosen the best answer that covers the question in general and linked to the answer that handles the specific question. What is the best way to document anonymous objects and functions with jsdoc? /** * @class {Page} Page Class