How to use JSdoc

JSDoc is meant to do for Javascript, what Javadoc does for Java.

It does.

We can download and install JSDoc easily:

1. Download JSDoc
2. Expand the tgz.gz file (I use Winrar)
3. Optional – I copy the jsdoc folder to my D: drive to make things easier
4. Reminder – you need a perl runtime installed.  ActivePerl is recommended
5. Open up a command prompt
6. Change to your JSDoc folder (mine is D:\JSDoc-1.10.2\)
7. Run it: “perl jsdoc.pl test.js” (to test it against the built in JS file)

JSDoc is like the following image

In the following all the parameter are showing..

ag Reference

The following is a summary of the supported tags (‘@’-attributes) that are supported by JSDoc. For actual examples of the usage of these tags, please see the test.js JavaScript file that is included in the JSDoc distribution.

@param Provide information about a function parameter. A datatype indicator can be added between curly braces with this tag, as follows:

        /**           * @param {String} paramName This is a string parameter           */
@argument Synonym for @param
@return Provide information about the return value of a function.
@returns Synonym for @return
@author Provide information about the author of a JavaScript file or a function.
@deprecated Signify that a function or class is deprecated, and should not be used if possible.
@see Link to another class or function that is of importance to the current class or function. This tag can take several forms.

To link to another method within the same class:

        @see #methodName

To link to another class:

        @see ClassName

To link to a specific method of another class:

        @see ClassName#methodName
@version Show the version number of the current file or class
@requires Define a dependency upon another class. The syntax for this tag is as follows:

        @requires OtherClassName This is text to be shown
@throws Show that a method can throw a certain type of exception. The syntax for this tag is:

        @throws ExceptionType This is the label text
@exception Synonym for @throws
@link This is a powerful tag that can be used to link to a large number of other pages. It is also the only tag that can be used in the description text of a documentation string before the ‘@’-tag section. The usage is very similar to that of the @see tag, but the entire tag is wrapped in curly braces. For example:

        /**           * This utility method is also a member of the {@link String} class,            * in the form of the {@link String#utility} method.            */
@fileoverview This is a special-use tag. If the first block of documentation in a file starts with a @fileoverview tag, the rest of the documentation block will be used to provide a file overview in the documentation.
@class This tag is used in a constructor’s documentation block to provide information about the actual class. The included documentation will then not be included in the constructor’s documentation.
@constructor Signify that a function is the constructor for a class.
@type Show the return type of a function. For example:

        /**           * This function returns a String.           * @return The name of the current user           * @type String           */
@extends Used to show that a class is a subclass of another class. JSDoc is often quite good at picking this up on its own, but in some situations this tag is required.
@private Signify that a function or class is private. Private classes and functions will not be available in the documentation unless JSDoc is run with the –private commandline option.
@final Flag a value as being a final (constant) value.
@member Show that a function is a member of a given class:

        /**           * @member MyClass           */   	function SomeFunc(){  	}
@ignore Tell JSDoc to totally ignore this method.
@base Force JSDoc to view the current class constructor as a subclass of the class given as the value to this tag:

       /**          * This is a subclass of Shape          * @constructor          * @base Shape          */         function Circle(){             // ...         }
@addon Mark a function as being an “addon” to a core JavaScript function that isn’t defined within your own sources, as shown below:

	/**   	 * This is an addon function to SomeCoreClass which is           * not defined within our own sources.   	 * @addon  	 */  	SomeCoreClass.someFunction = function(){               // ...  	}
@exec Experimental!

Force JSDoc to “execute” this method as part of its preprocessing step, in the same way that class contructors are executed. This can allow attributes to be added to a class from within a function.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.