Merge pull request #422 from jareguo/master

complete api syntax for CCClass options
This commit is contained in:
Jare Guo
2016-03-01 22:30:04 +08:00
3 changed files with 75 additions and 76 deletions
-69
View File
@@ -744,86 +744,19 @@ var Component = cc.Class({
},
});
/**
* Automatically add required component as a dependency.
*
* @property _requireComponent
* @type {Function}
* @default null
* @static
* @readonly
* @private
*/
Component._requireComponent = null;
if (CC_DEV) {
// INHERITABLE STATIC MEMBERS
/**
* Makes a component execute in edit mode.
* By default, all components are only executed in play mode,
* which means they will not have their callback functions executed while the Editor is in edit mode.
*
* @property _executeInEditMode
* @type {Boolean}
* @default false
* @static
* @readonly
* @private
*/
Component._executeInEditMode = false;
/**
* This property is only available if _executeInEditMode is true.
* If specified, the editor's scene view will keep updating this node in 60 fps when it is selected,
* otherwise, it will update only if necessary.
*
* @property _playOnFocus
* @type {Boolean}
* @default false
* @static
* @readonly
* @private
*/
Component._playOnFocus = false;
/**
* If specified to a type, prevents Component of the same type (or subtype) to be added more than once to a Node.
*
* @property _disallowMultiple
* @type {Function}
* @default null
* @static
* @readonly
* @private
*/
Component._disallowMultiple = null;
// NON-INHERITED STATIC MEMBERS
/**
* Specifying the url of the custom html to draw the component in inspector.
*
* @property _inspector
* @type {String}
* @default ""
* @static
* @readonly
* @private
*/
Object.defineProperty(Component, '_inspector', { value: '', enumerable: false });
/**
* Specifying the url of the icon to display in inspector.
*
* @property _icon
* @type {String}
* @default ""
* @static
* @readonly
* @private
*/
Object.defineProperty(Component, '_icon', { value: '', enumerable: false });
// COMPONENT HELPERS
@@ -876,8 +809,6 @@ Object.defineProperty(Component, '_registerEditorProps', {
Object.defineProperty(cls, '_icon', { value: val });
break;
// {String} menu
// The menu path to register a component to the editors "Component" menu. Eg. "Rendering/Camera"
case 'menu':
Component._addMenuItem(cls, val, props.menuPriority);
break;
+73 -2
View File
@@ -658,12 +658,83 @@ function declareProperties (cls, className, properties, baseClass, mixins) {
}
}
/**
* @class _ComponentAttributes
* @constructor
*/
/**
* Automatically add required component as a dependency.
*
* @property requireComponent
* @type {Component}
* @default null
*/
/**
* If specified to a type, prevents Component of the same type (or subtype) to be added more than once to a Node.
*
* @property disallowMultiple
* @type {Component}
* @default null
*/
/**
* The menu path to register a component to the editors "Component" menu. Eg. "Rendering/Camera".
*
* @property menu
* @type {String}
* @default ""
*/
/**
* Makes a component execute in edit mode.
* By default, all components are only executed in play mode,
* which means they will not have their callback functions executed while the Editor is in edit mode.
*
* @property executeInEditMode
* @type {Boolean}
* @default false
*/
/**
* This property is only available if executeInEditMode is true.
* If specified, the editor's scene view will keep updating this node in 60 fps when it is selected,
* otherwise, it will update only if necessary.
*
* @property playOnFocus
* @type {Boolean}
* @default false
*/
/**
* Specifying the url of the custom html to draw the component in inspector.
*
* @property inspector
* @type {String}
* @default ""
*/
/**
* Specifying the url of the icon to display in inspector.
*
* @property icon
* @type {String}
* @default ""
*/
/**
* @module cc
*/
/**
* !#en Defines a CCClass using the given specification, please see [Class](/en/scripting/class/) for details.
* !#zh 定义一个 CCClass,传入参数必须是一个包含类型参数的字面量对象,具体用法请查阅[类型定义](/zh/scripting/class/)。
*
*
* @method Class
* @param {Object} options
*
* @param {Object} [options]
* @param {String} [options.name] - The class name used for serialization.
* @param {Function} [options.extends] - The base class.
* @param {Function} [options.ctor] - The constructor.
* @param {Object} [options.properties] - The property definitions.
* @param {Object} [options.editor] - The attributes for Component, see {{#crossLink "_ComponentAttributes"}}ComponentAttributes{{/crossLink}}.
* @param {Object} [options.statics] - The static members.
* @param {Function[]} [options.mixins]
*
* @return {Function} - the created class
*
* @example
+2 -5
View File
@@ -30,7 +30,6 @@ var FireClass = require('../platform/CCClass');
/**
* Representation of 2D vectors and points.
*
* see {{#crossLink Vec2 }}cc.Vec2{{/crossLink}}
* @class Vec2
* @extends ValueType
* @constructor
@@ -470,14 +469,12 @@ JS.get(Vec2, 'RIGHT', function () {
cc.Vec2 = Vec2;
/**
*
* @module cc
*
*/
/**
* The convenience method to create a new {{#crossLink Vec2/Vec2 }}{{/crossLink}}
* The convenience method to create a new {{#crossLink "Vec2"}}cc.Vec2{{/crossLink}}.
* @method v2
* @param {Number|Object} [x=0]
* @param {Number} [y=0]
@@ -488,7 +485,7 @@ cc.v2 = function v2 (x, y) {
};
/**
* Helper function that creates a cc.Vec2.
* The convenience method to creates a new {{#crossLink "Vec2"}}cc.Vec2{{/crossLink}}.
* @method p
* @param {Number|Object} [x=0] a Number or a size object
* @param {Number} [y=0]