JSDoc参考注释模板

1. 注释宏或者常量 

/**

 * Default Node tag
 * @constant
 * @type Number
 */
cc.CCNODE_TAG_INVALID = -1;

 

 

2. 注释的分段采用<p>,<br/>,</P> 

 

3.注明类和继承方式

/** 

 * @class

 * @extends cc.Class

 */

cc.Node = cc.Class.extend(/** @lends cc.Node# */{

});

 

 

4. 静态构造函数的注释

/** allocates and initializes a node.

 *

 * @constructs

 * @return {cc.Node}

 * @example

 * // example

 * var node = cc.Node.create();

 */

cc.Node.create = function () {

    return new this();

};

 

5. 函数方法的注释方式:

    /** converts a CCTouch (world coordinates) into a local coordiante. This method is AR (Anchor Relative).

     *

     * @param {cc.Touch}touch

     * @return {cc.Point}

     */

    convertTouchToNodeSpaceAR:function (touch) {

        var point = touch.locationInView(touch.view());

        point = cc.Director.sharedDirector().convertToGL(point);

        return this.convertToNodeSpaceAR(point);

    },

其中数据类型有:Number, Boolean, Array,String,object,function,以及引擎的自定义类型,比如cc.Node,cc.Sprite等。

 

6. 名字空间

 /**

 * @namespace

 */

var cc = cc = cc || {}; 

 

 

 

posted on 2012-06-11 14:39  SeanLin  阅读(6596)  评论(0编辑  收藏  举报

导航