API Documentation for: 1.1.2
Show:

Canteen.EventDispatcher Class

Namespace: Canteen

The EventDispatcher mirrors the functionality of AS3 and CreateJS's EventDispatcher, but is more robust in terms of inputs for the on() and off() methods.

Item Index

Properties

Methods

_callbackIndex

(
  • name
  • callback
)
Int private

Returns callback array index.

Parameters:

Returns:

Int:

Callback array index, or -1 if isn't registered.

off

(
  • name
  • callback
)

Remove the event listener

Parameters:

  • name String*

    The type of event string separated by spaces, if no name is specifed remove all listeners.

  • callback Function | Array*

    The listener function or collection of callback functions

on

(
  • name
  • callback
)
cloudkid.EventDispatcher

Add an event listener

Parameters:

  • name String | Object

    The type of event (can be multiple events separated by spaces), or a map of events to handlers

  • callback Function | Array*

    The callback function when event is fired or an array of callbacks.

Returns:

cloudkid.EventDispatcher:

Return this EventDispatcher

trigger

(
  • type
  • params
)

Dispatch an event

Parameters:

  • type String

    The event string name,

  • params

    Additional parameters

type

(
  • value
)
String private

Return type of the value.

Parameters:

  • value

Returns:

String:

The type

Properties

_listeners

Array private

The collection of listeners