API Documentation for: 1.0.6
Show:

EventDispatcher Class

Defined in: EventDispatcher:8
Namespace: cloudkid

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.

Constructor

EventDispatcher

()

Defined in EventDispatcher:8

Item Index

Properties

Methods

_callbackIndex

(
  • name
  • callback
)
Int private

Defined in _callbackIndex:163

Returns callback array index.

Parameters:

Returns:

Int:

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

off

(
  • name
  • callback
)

Defined in off:94

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
)
EventDispatcher

Defined in on:46

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:

EventDispatcher:

Return this EventDispatcher

trigger

(
  • type
  • params
)

Defined in trigger:27

Dispatch an event

Parameters:

  • type String

    The event string name,

  • params

    Additional parameters

type

(
  • value
)
String private

Defined in type:142

Return type of the value.

Parameters:

  • value

Returns:

String:

The type

Properties

_listeners

Array private

Defined in _listeners:20

The collection of listeners