-
Notifications
You must be signed in to change notification settings - Fork 15
Coding conventions
laggery edited this page Jan 25, 2013
·
29 revisions
Example
If (ttt = 0) {
example: function (str) {
return "asdasddasd";
}
}
for (i=0; i<10; i++) {
}
JSDoc module allows generating the JavaScript documentation. To recognize automatically the comments from a Js document, there are some rules.
- The first tag in the JS file should be @fileoverview. This tag allows the plugin JSDoc to recognize that the file must be parsed and also allows him to interpret the tags @authors and @version
- For declaring the class you need to use the tag @class preceded by @name tag with the name of the class
- A class can also extend another one. For this, two tags exists : @extends and @augments
- Directly after instantiating the widget add the tag @lends class name# Attention the # at end of the tag, means that is NOT a static method
- before commenting on ATTRS, you must add the tag @lends class name again Attention This time there is no # at end of the tag, this indicate that is a static method. To be clear, all method of this section has the tag @static
- For add an event, you must use the tag @event
- JSDoc didn’t contain a tag for attributes (ATTRS), follow the attributes example
For complete examples you can refer to wegas-app.js, wegas-joingamewidget.js, wegas-jointeamwidget.js and wegas-panelwidget.js
@fileoverview
Eventual description of the JS file content
@authors authors name
@name Y.Wegas.PanelWidget
@extends Y.Panel
@class class for creating panel from a JSON file with children
@constructor
@param Object Will be used to fill attributes field
@description Create a panel with all children
@name Class name
@extends Extended class name
@class Class description
###After instantiating the widget###
@lends Y.Wegas.App#
@function
@return {type} Return description
@description Method description
@function
@static
@description Method description
@function
@private
@description Method description
@event
@description Event description
@lends Y.Wegas.App
@field
@static
@description
<p><strong>Method</strong></p>
<ul>
<li>base: Base Url for app, <i>default: /Wegas/</i></li>
<li>layoutSrc : xxxxxxxxxxxxxxx</li>
</ul>
Wiki jsdoc plugin : http://code.google.com/p/jsdoc-toolkit/w/list
Available tags : http://code.google.com/p/jsdoc-toolkit/wiki/TagReference