Cocos Creator API

1.0.0

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

CallbacksInvoker

Module: cc

The callbacks invoker to handle and invoke callbacks by key

Methods

invoke
(
  • key
  • [p1 ]
  • [p2 ]
  • [p3 ]
  • [p4 ]
  • [p5 ]
)

name type description
key String
p1 optional Any
p2 optional Any
p3 optional Any
p4 optional Any
p5 optional Any

invokeAndRemove
(
  • key
  • [p1 ]
  • [p2 ]
  • [p3 ]
  • [p4 ]
  • [p5 ]
)

name type description
key String
p1 optional Any
p2 optional Any
p3 optional Any
p4 optional Any
p5 optional Any

bindKey
(
  • key
  • [remove =false]
)
Function

name type description
key String
remove optional Boolean false

remove callbacks after invoked

returns:

type: Function

the new callback which will invoke all the callbacks binded with the same supplied key

add
(
  • key
  • callback
  • [target ]
)
Boolean

name type description
key String
callback Function
target optional Object

can be null

returns:

type: Boolean

whether the key is new

has
(
  • key
  • [callback ]
  • [target ]
)
Boolean

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.

name type description
key String
callback optional Function
target optional Object

returns:

type: Boolean

removeAll
(
  • key
)

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

name type description
key String | Object

The event key to be removed or the target to be removed

remove
(
  • key
  • callback
  • target
)
Boolean

name type description
key String
callback Function
target Object

returns:

type: Boolean

removed

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index