jsdoc

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 () {

How to document a string type in jsdoc with limited possible values

不羁岁月 提交于 2019-11-27 04:18:22
问题 I am having a function that accepts one string parameter. This parameter can have only one of a few defined possible values. What is the best way to document the same? Should shapeType be defined as enum or TypeDef or something else? Shape.prototype.create = function (shapeType) { // shapeType can be "rect", "circle" or "ellipse"... this.type = shapeType; }; Shape.prototype.getType = function (shapeType) { // shapeType can be "rect", "circle" or "ellipse"... return this.type; }; The second

How to describe “object” arguments in jsdoc?

*爱你&永不变心* 提交于 2019-11-27 02:33:19
// My function does X and Y. // @params {object} parameters An object containing the parameters // @params {function} callback The callback function function(parameters, callback) { } But how do I describe how the parameters object should be structured? For example it should be something like: { setting1 : 123, // (required, integer) setting2 : 'asdf' // (optional, string) } Jonny Buchanan From the @param wiki page : Parameters With Properties If a parameter is expected to have a particular property, you can document that immediately after the @param tag for that parameter, like so: /** *

Document collection (array of type) return value and parameter in JSDoc

做~自己de王妃 提交于 2019-11-27 01:48:38
问题 How to document Array return value (and parameters) in JSDoc when array elements can be either of the following: A type (e.g. String , Array ). An object literal. 回答1: If you're looking for how to document the type of objects in an array, you want something like this: /** * @param {String[]} aliases */ http://code.google.com/p/jsdoc-toolkit/wiki/TagParam#Parameter_Type_Information 回答2: Given a screenings parameter: screenings = [ { timestamp: 1440157537, url: 'https://stackoverflow.com/a

How to document anonymous functions (closure) with jsdoc-toolkit

你说的曾经没有我的故事 提交于 2019-11-27 01:46:19
问题 I am trying to document my code using JSDoc-toolkit. My code starts by being wrapped with a self-executing anonymous function. How in the world do I document this? I've spent nearly all day on this. JS Docs will not recognize anything inside of the anonymous function closure due to it not knowing what to do with it. It breaks and none of my comments come through. My code looks something like this. /** * @fileoverview BLA BLA BLA */ /** * This is where I don't know what to put. */ (function ()

Correct way to document open-ended argument functions in JSDoc

拜拜、爱过 提交于 2019-11-27 00:44:19
Let's say you have something like the following: var someFunc = function() { // do something here with arguments } How would you correctly document that this function can take any number of arguments in JSDoc? This is my best guess, but I'm not sure it's correct. /** * @param {Mixed} [...] Unlimited amount of optional parameters */ var someFunc = function() { // do something here with arguments } Related to: php - How to doc a variable number of parameters The JSDoc specs and Google's Closure Compiler do it this way: @param {...number} var_args Where "number" is the type of arguments expected.

Correct way to document open-ended argument functions in JSDoc

荒凉一梦 提交于 2019-11-26 17:27:49
问题 Let's say you have something like the following: var someFunc = function() { // do something here with arguments } How would you correctly document that this function can take any number of arguments in JSDoc? This is my best guess, but I'm not sure it's correct. /** * @param {Mixed} [...] Unlimited amount of optional parameters */ var someFunc = function() { // do something here with arguments } Related to: php - How to doc a variable number of parameters 回答1: The JSDoc specs and Google's