JSDOC Annotation Specification

Source: Internet
Author: User
Tags deprecated

Command name Description

@param @argument Specify parameter names and descriptions to describe a function parameter
@returns describes the return value of a function
@author indicates the author of the Code
@deprecated indicates that a function has been deprecated and will be completely removed in future versions of the code. To avoid using this code
@see Create an HTML link that points to the description of the specified class
@version specifying a release version
@requires Create an HTML link that points to the specified class required by this class
@throws @exception Describe the type of exception that a function might throw
{@link} creates an HTML link that points to the specified class. This is similar to @see, but {@link} can be embedded in the comment text
@fileoverview This is a special marker. If you use this tag in the first document block of a file, you specify that the remainder of the document block will be used to provide an overview of the file
@class provides information about the class used in the document of the constructor
@constructor explicitly that a function is a constructor of a class
@type The return type of the specified function
@extends indicates that a class derives from another class. JSDoc is usually able to detect this information by itself, but in some cases it must be used
@private indicates that a class or function is private. Private classes and functions do not appear in HTML documents unless –private command-line options are available when running JSDoc
@final indicates that a value is a constant value. Remember that JavaScript cannot really guarantee that a value is a constant
@ignore JSDoc ignores functions with this tag

Example 1:

/**
* @fileOverview A simple way to annotate an example
* @author <a href= "llying.javaeye.com" >llying</a>
* @version 0.1
*/

/**
* @description addition Operation
* @param {Num} num1 addend
* @param {Num} num2 summand
* @return {Num} result results
*/
function Add (num1,num2) {
return NUM1 + num2;
}

/**
* @description Subtraction Operation
* @param {Num} num1
* @param {Num} num2 is subtracted
* @return {Num} result results
*/
function minus (num1,num2) {
return num1–num2;
}

Example 2:

/**
* @fileOverview Simple example of class object labeling
* @author <a href= "llying.javaeye.com" >llying</a>
* @version 0.1
*/

/**
* @author llying
* @constructor person
* @description a person class
* @see the <a href= "#" >LLYING</A;.
* @example New Parent ("Zhang San");
* @since version 0.1
* @param {String} username name
* @param {Num} age
*/
function Person (username,age)
{
/**
* @description {Sting} name
* @field
*/
this.username = Username;

/**
* @description {Num} age
* @field
*/
this.age = age;

/**
* @description popup say content
* @param {String} content contents
*/
This.say = function (content)
{
alert (this.username+ "say:" +content);
}

/**
* @description return objects in JSON format
* @return {String} JSON format
* @see Person#say
*/
This.getjson = function () {
return "{name:" +this.username+ ", Age" +this.age+ "}";
}
}

JSDOC Annotation Specification

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.