Trigger an event directly with the event name and necessary arguments.
event type
Arguments when the event triggered
Checks whether there is correspond event listener registered on the given event
Event type
Callback function when event triggered
Callback callee
Removes the listeners previously registered with the same type, callback, target and or useCapture, if only type is passed as parameter, all listeners registered with that type will be removed.
A string representing the event type being removed.
The callback to remove.
The target (this object) to invoke the callback, if it's not given, only callback without target will be removed
The event type
The event listener's callback
The event listener's target and callee
The event type
The event listener's callback
The event listener's target and callee
The event type
The event listener's callback
The event listener's target and callee
The event type
The event listener's callback
The event listener's target and callee
Register an callback of a specific event type on the EventTarget, the callback will remove itself after the first time it is triggered.
A string representing the event type to listen for.
The callback that will be invoked when the event is dispatched. The callback is ignored if it is a duplicate (the callbacks are unique).
The target (this object) to invoke the callback, can be null
Removes all callbacks registered in a certain event type or all callbacks registered with a certain target
The event type or target with which the listeners will be removed
Sets whether to enable the accelerometer event listener or not.
Sets the accelerometer interval value.
Removes all callbacks previously registered with the same target (passed as parameter). This is not for removing all listeners in the current event target, and this is not for removing all listeners the target parameter have registered. It's only for removing all listeners (callback and target couple) registered on the current event target by the target parameter.
Generated using TypeDoc
The System event, it currently supports keyboard events and accelerometer events.
You can get the SystemEvent instance with cc.systemEvent.
cc.systemEvent.on(cc.SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this); cc.systemEvent.off(cc.SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);