Javascript - JsDoc

> (World Wide) Web - (W3|WWW) > Javascript (Js|ECMAScript)

1 - 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.

Advertising

3 - Example

/**
* @param myParam1
* @param myParam2
*/
function loadDocs(myParam1, myParam2){}
 
 
/**
 * @memberOf   myLib
 * or
 * @name       myLib.MyDynamicallyLoadedModule
 */
var MyDynamicallyLoadedModule = {};
/**
 * 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
 */

or

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

or

/**
 * @param {Type} someParam
 * @return {undefined} 
 */
function testFunction(someParam) {
  //
}
/**
 *  @class MyView
 *  @augments Backbone.View
 *  @static 
*/

In intellij 11 there are three ways to express typeof type:

{typeof someVar} // TypeScript's way
{someVar.} // Google Closure Compiler's team suggestion
{someVar.prototype.constructor} // this ticket's suggestion

4 - Documentation / Reference