Essentials of Javascript - Cultural View

Essentials of Javascript - Cultural View Essentials of Javascript - Cultural View

culturalview.com
from culturalview.com More from this publisher
14.07.2013 Views

JSAN 87 JSAN JSAN, also known as the JavaScript Archive Network, is an on-line collaborative resource to develop Open Source libraries and software for JavaScript. JSAN's aim is to create the JavaScript equivalent of Perl' s CPAN. For example, the module Joose is an equivalent to the CPAN module Moose. In addition there is Test.Simple and other modules that are very similar to their Perl counterparts. Background JSAN was created by Casey West in 2005. Due to social reasons Casey West left the project. With the master website lost, people could not upload modules, and JSAN had several other limitations in its development, and it was considered "dead". On May 2009, the site was revived and new modules started being added. Design JSAN works as a CPAN module, using a nearly identical testing system and directory structure. Documentation is written in POD which is used within JavaScript comments. The documentation is then converted to HTML and other formats with Perl POD modules. Some of the newer techniques used in JSAN are considered to be "test runs" for new features to be added to the design of the "6PAN", the CPAN upgrade intended to match the Perl 6 language. See also • JSAN Wiki [1] - Wiki used in the JSAN project • CPAN - the Perl equivalent of JSAN External links • JSAN [2] - the JavaScript Archive Network References [1] http://wiki.github.com/openjsan/openjsan [2] http://www.openjsan.org

JSDoc 88 JSDoc JSDoc is a syntax for adding inline API documentation to JavaScript source code. This is distinct from the various tools that parse and manipulate code that follows the JSDoc syntax. The JSDoc syntax is similar to the Javadoc syntax, used for documenting Java code, but is specialized to work with JavaScript's more dynamic syntax and therefore unique, as it is not completely compatible with Javadoc. However, like Javadoc, JSDoc allows the programmer to create doclets and tags which can then be translated into published output, like HTML or RTF. JSDoc tags Although this list is incomplete, the following annotations are commonly used in modern JSDoc. Example An example of JSDoc usage. /** Tag Description @author Developer's name @constructor Marks a function as a constructor @deprecated Marks a method as deprecated @exception Synonym for @throws @param Documents a method parameter; a datatype indicator can be added between curly braces @private Signifies that a method is private @return Documents a return value @see Documents an association to another object @this Specifies the type of the object to which the keyword "this" refers within a function. @throws Documents an exception thrown by a method @version Provides the version number of a library * Creates an instance of Circle. * * @constructor * @this {Circle} * @param {number} r The desired radius of the circle. */ function Circle(r) { } /** /** @private */ this.radius = r; /** @private */ this.circumference = 2 * Math.PI * r; * Creates a new Circle from a diameter. * * @param {number} d The desired diameter of the circle.

JSDoc 88<br />

JSDoc<br />

JSDoc is a syntax for adding inline API documentation to JavaScript source code. This is distinct from the various<br />

tools that parse and manipulate code that follows the JSDoc syntax.<br />

The JSDoc syntax is similar to the Javadoc syntax, used for documenting Java code, but is specialized to work with<br />

JavaScript's more dynamic syntax and therefore unique, as it is not completely compatible with Javadoc. However,<br />

like Javadoc, JSDoc allows the programmer to create doclets and tags which can then be translated into published<br />

output, like HTML or RTF.<br />

JSDoc tags<br />

Although this list is incomplete, the following annotations are commonly used in modern JSDoc.<br />

Example<br />

An example <strong>of</strong> JSDoc usage.<br />

/**<br />

Tag Description<br />

@author Developer's name<br />

@constructor Marks a function as a constructor<br />

@deprecated Marks a method as deprecated<br />

@exception Synonym for @throws<br />

@param Documents a method parameter; a datatype indicator can be added between curly braces<br />

@private Signifies that a method is private<br />

@return Documents a return value<br />

@see Documents an association to another object<br />

@this Specifies the type <strong>of</strong> the object to which the keyword "this" refers within a function.<br />

@throws Documents an exception thrown by a method<br />

@version Provides the version number <strong>of</strong> a library<br />

* Creates an instance <strong>of</strong> Circle.<br />

*<br />

* @constructor<br />

* @this {Circle}<br />

* @param {number} r The desired radius <strong>of</strong> the circle.<br />

*/<br />

function Circle(r) {<br />

}<br />

/**<br />

/** @private */ this.radius = r;<br />

/** @private */ this.circumference = 2 * Math.PI * r;<br />

* Creates a new Circle from a diameter.<br />

*<br />

* @param {number} d The desired diameter <strong>of</strong> the circle.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!