CallbacksInvoker Class

Defined in: https://github.com/cocos-creator/engine/blob/2fda22be5638065a190bc4c97da6548631319aba/cocos2d/core/platform/callbacks-invoker.js:158

Module: cc Parent Module: cc

The callbacks invoker to handle and invoke callbacks by key.

Index

Methods
  • hasEventListener Check if the specified key has any registered callback.
  • removeAll Removes all callbacks registered in a certain event type or all callbacks registered with a certain target
  • off
  • emit Trigger an event directly with the event name and necessary arguments.

Details

Methods

hasEventListener

Check if the specified key has any registered callback. If a callback is also specified, it will only return true if the callback is registered.

meta description
Returns Boolean
Defined in cocos2d/core/platform/callbacks-invoker.js:188
Parameters
removeAll

Removes all callbacks registered in a certain event type or all callbacks registered with a certain target

meta description
Defined in cocos2d/core/platform/callbacks-invoker.js:235
Parameters
  • keyOrTarget String | Object The event key to be removed or the target to be removed
off
meta description
Defined in cocos2d/core/platform/callbacks-invoker.js:279
Parameters
emit

Trigger an event directly with the event name and necessary arguments.

meta description
Defined in cocos2d/core/platform/callbacks-invoker.js:309
Parameters
  • key String event type
  • arg1 Any First argument
  • arg2 Any Second argument
  • arg3 Any Third argument
  • arg4 Any Fourth argument
  • arg5 Any Fifth argument
Examples
eventTarget.emit('fire', event);
eventTarget.emit('fire', message, emitter);

results matching ""

    No results matching ""