JsDoc Use and Configuration!

Source: Internet
Author: User
Tags deprecated

Original address: http://www.cnblogs.com/hxling/archive/2012/11/27/2791067.html

JsDoc is to help you to generate JS document, but there is a premise, is that you write the JS code, you need to write the comments in a certain format, the tool software to help you correctly generate the document!

First, configure the use of the environment. This software is written in Java, so we want to configure the Java environment variables in the Windows system

1, download the JDK (http://java.sun.com/javase/downloads/index.jsp), I downloaded the version is: Jdk-6u14-windows-i586.exe

2, Installation Jdk-6u14-windows-i586.exe

3. Configure environment variables: Right-click "My Computer"-"advanced"-"Environment variables"

1) Create a new java_home variable in the system variable , the value of the variable is: C:\Program files\java\jdk1.6.0_14 (fill in according to your own installation path)

2) New CLASSPATH variable, variable value is:.; %java_home%\lib;%java_home%\lib\tools.jar

3) Add the variable value in the path variable (existing without new):%java_home%\bin;%java_home%\jre\bin (Note the ";" between the variable values) Separated

4. "Start"-"Run"-enter "Javac" and "enter", if you can print the usage instructions correctly, the configuration is successful!

Analysis of supplemental environment variables:

Installation path for JAVA_HOME:JDK

Classpath:java load Classpath, only the class is recognized by the Java command in Classpath, and a "." is added before the path. Represents the current path.

Path: The Java,javac command can be recognized by the system under any path.

Second, download Jsdoc_toolkit, and unzip

Third, here we need to create a JavaScript document from the command line.

Java-jar Jsrun.jar app/run.js-a-e=gb18030-t=templates/jsdoc test/*.js

Of course, if you feel the hassle of using the command line, we can create a. bat file on our own
Copy the above content into the file and execute it.
Let me briefly explain the parameters of this
-A means all the way
-E represents the encoding radicals for the corresponding file here is the GB18030 default is Utf-8
-T represents a document style template for producing doc
The test/*.js here indicates that all JavaScript files in the test directory
After execution, the document results are output to the/out/jsdoc directory by default.

Jsrun.jar App/run.js can use the parameters, you can enter the following command in CMD to view
Java-jar Jsrun.jar app/run.js--help

IV. Specification of command names

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

The note begins with/** and ends with */, the keyword begins with @

Reference website: http://usejsdoc.org
Http://www.36ria.com/5101

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.