Child pages
  • JSDoc Annotations

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Use case

Tag

Example

function parameters

@param

/**
 * @param {String} value Just some string value
 */
function demo(value)
{...}

function return type

@return
@returns

/**
 * @param {String} value Just some string value
 * @return x:Number, y:Number  */
function demo(value) {
   ...
   return {x: 10, y: 20}
}

functions exceptions

@throws

/** 
 * @throws {Number} 
 */ 
function demo(value) 
{
  ...
 throw -1;
}

variables

@type

/**
 * @type {XML}
 */
var html = <html>
   <head>
   </head>
   <body>
      Hello World!
   </body>
</html>

 

 

 

A Type Expression is to always be surrounded by curly braces: {typeExpression}. Note that when using the Object Type expression variation that start and stops with curly braces as well, this results in double opening and closing braces.

Expression name

Syntax example

Context

Comments

Named type

{String}
{Boolean}
{Number}
{XML}
{XMLList}
{RuntimeForm}
{RuntimeLabel}
{JSButton}
{JSForm}

@param, @return, @type, @throws

 

AnyType

*

@param, @return, @type, @throws

 

OR Type

{String|Number}
Either a String or a Number

@param, @return, @type, @throws

 

REST Type

{...String}

@param

 

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0d96287637fd2d95-8ca2ebb2-45904a21-a4e9b9be-7187fc910927dce4e4fc00d4"><ac:plain-text-body><![CDATA[

Array Type

{String[]} 
]]></ac:plain-text-body></ac:structured-macro>
{Array<String>} 
{Array<Byte>}

@param, @return, @type, @throws

 

Object Type

{Object<String>} 
{Object<Array<String>>} 
{name:String, age:Number}} 

@param, @return, @type, @throws

 

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="b7b5bc18cadee61f-8a79a05e-4975441a-93a58941-2d9bcd7ebad5082fa4507a2a"><ac:plain-text-body><![CDATA[

Object Type with optional properties

{ {sDocID:String, [sTemplateID]:String}}
]]></ac:plain-text-body></ac:structured-macro>
{ {sDocID:String, sTemplateID:String=}}

@param, @return, @type, @throws

 

JSFoundSet type

{JSFoundset<db:/udm/contacts>}1    
{JSFoundset<{column1:String, column2:Number}>}

@param, @return, @type

 

JSRecord type

{JSRecord<db:/udm/contacts>}{^}1^
{JSRecord<{column1:String, column2:Number}>}

@param, @return, @type

 

JSDataSet type

{JSDataSet<{name:String, age:Number}>}

@param, @return, @type

 

RuntimeForm Type

{RuntimeForm<superFormName>}

@param, @return, @type

 

^1^ the value in between <..> is the datasource notation that is built up of the database server and tablename: db:/{serverName}/{tableName}

...