Dispatcher

Moduleejs.events
Definition class Dispatcher
InheritanceDispatcher inherit Object

The Dispatcher class supports the registration of listeners who want notification of events of interest.

WARNING: This class is prototype and it not currently supported.


Properties

QualifiersPropertyTypeDescription
No properties defined

Dispatcher Methods

QualifiersMethod
public addListener(callback: Function, eventType: Type = Event): Void
 Add a listener function for events.
public dispatch(event: Event): Void
 Dispatch an event to the registered listeners.
Dispatcher()
 Construct a new event Dispatcher object.
public removeListener(callback: Function, eventType: Type = Event): Void
 Remove a registered listener.

Method Detail

public addListener(callback: Function, eventType: Type = Event): Void

Add a listener function for events.

Parameters
callback: Function Function to call when the event is received.
eventType: Type Event class to listen for. The listener will receive events of this event class or any of its subclasses. Defaults to Event. [default: Event]

public dispatch(event: Event): Void

Dispatch an event to the registered listeners.

Description
This is called by the class owning the event dispatcher.
Parameters
event: Event Event instance to send to the listeners.

public Dispatcher()

Construct a new event Dispatcher object.


public removeListener(callback: Function, eventType: Type = Event): Void

Remove a registered listener.

Parameters
eventType: Type Event class used when adding the listener. [default: Event]
callback: Function Listener callback function used when adding the listener.