improve event api doc

This commit is contained in:
Jare Guo
2016-09-21 17:31:16 +08:00
parent 0ee033d7b8
commit 6e4a7a207c
+6 -5
View File
@@ -1121,7 +1121,8 @@ var Node = cc.Class({
* 同时您可以将事件派发到父节点或者通过调用 stopPropagation 拦截它。<br/>
* 推荐使用这种方式来监听节点上的触摸或鼠标事件,请不要在节点上直接使用 cc.eventManager。
* @method on
* @param {String} type - A string representing the event type to listen for.
* @param {String} type - A string representing the event type to listen for.<br>
* See {{#crossLink "Node/position-changed:event"}}Node Events{{/crossLink}} for all builtin events.
* @param {Function} callback - The callback that will be invoked when the event is dispatched.
* The callback is ignored if it is a duplicate (the callbacks are unique).
* @param {Event} callback.param event
@@ -1132,11 +1133,12 @@ var Node = cc.Class({
* Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET.
* @return {Function} - Just returns the incoming callback so you can save the anonymous function easier.
* @example
* // add Node Touch Event
* this.node.on(cc.Node.EventType.TOUCH_START, this.memberFunction, this); // if "this" is component and the "memberFunction" declared in CCClass.
* node.on(cc.Node.EventType.TOUCH_START, callback, this.node);
* node.on(cc.Node.EventType.TOUCH_MOVE, callback, this.node);
* node.on(cc.Node.EventType.TOUCH_END, callback, this.node);
* node.on(cc.Node.EventType.TOUCH_CANCEL, callback, this.node);
* node.on("anchor-changed", callback, this);
*/
on: function (type, callback, target, useCapture) {
var newAdded = false;
@@ -1202,9 +1204,9 @@ var Node = cc.Class({
* one with capture and one without, each must be removed separately. Removal of a capturing callback
* does not affect a non-capturing version of the same listener, and vice versa.
* @example
* // remove Node TOUCH_START Event.
* node.on(cc.Node.EventType.TOUCH_START, callback, this.node);
* this.node.off(cc.Node.EventType.TOUCH_START, this.memberFunction, this);
* node.off(cc.Node.EventType.TOUCH_START, callback, this.node);
* node.off("anchor-changed", callback, this);
*/
off: function (type, callback, target, useCapture) {
this._EventTargetOff(type, callback, target, useCapture);
@@ -1495,7 +1497,6 @@ if (CC_JSB) {
* @param {Event} event
* @param {Vec2} event.detail - The old position, but this parameter is only available in editor!
*/
/**
/**
* @event size-changed
* @param {Event} event