Javascript - JsDoc

About

JavaScript Documentation Tool (JSDoc) is a tool that parses inline documentation in JavaScript source files, and produces an documentation of the JavaScript code.

JSDoc is based on javadoc tool that was created for the same purpose for the Java programming language.

Tag

Variable (MemberOf / Full qualified name)

/**
 * @memberOf   myLib
 * or
 * @name       myLib.MyDynamicallyLoadedModule
 */
var MyDynamicallyLoadedModule = {};

Object (Property)

/**
 * Test interface
 * @typedef {Object} Type
 * @property {String} tString - I'm a string
 * @property {Boolean} tBoolean - I'm a boolean
 * @property {Number} [tNumber=100] - I'm a number with a default value of 100
 * @property {Function} tFunction - I'm a function
 */

Global Variable

/* global d3 */
/* global $ */

Function (param, return)

/**
 * @param {Type} someParam
 * @return {undefined} 
 */
function testFunction(someParam) {
  //
}
/**
* @param myParam1
* @param {string=} myParam2 - an optional parameter
* @param {string} [somebody] - Somebody is an optional parameter
*/
function loadDocs(myParam1, myParam2){}

Class (Static, augtments, …

/**
 *  @class MyView
 *  @augments Backbone.View
 *  @static 
*/

fileoverview

example:

/**
 * @fileoverview Search developers.google.com/web for articles tagged
 * "Headless Chrome" and scrape results from the results page.
 */

Library

Type checking with JsDoc and Typescript

Documentation / Reference


Powered by ComboStrap