Cocos Creator API

1.2.0

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

CallbacksInvoker

模块: cc

CallbacksInvoker 用来根据 Key 管理并调用回调方法。

方法

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

名称 类型 描述
key String
p1 optional Any
p2 optional Any
p3 optional Any
p4 optional Any
p5 optional Any

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

名称 类型 描述
key String
p1 optional Any
p2 optional Any
p3 optional Any
p4 optional Any
p5 optional Any

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

名称 类型 描述
key String
remove optional Boolean false

remove callbacks after invoked

返回:

类型: Function

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

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

名称 类型 描述
key String
callback Function
target optional Object

can be null

返回:

类型: 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.

名称 类型 描述
key String
callback optional Function
target optional Object

返回:

类型: Boolean

removeAll
(
  • key
)

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

名称 类型 描述
key String | Object

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

remove
(
  • key
  • callback
  • target
)
Boolean

名称 类型 描述
key String
callback Function
target Object

返回:

类型: 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