EventDispatcher

EventDispatcher

A basic EventDispatcher Class.


Constructor

new EventDispatcher()

Members

_listeners

constructor

Methods

addEventListener(type, listenerMethod, listenerObject)

Adds a listener method to be dispatched.

Parameters:
Name Type Description
type String

The type of Event to listen for.

listenerMethod String

The function to call when the Event fires.

listenerObject Object

The object that contains the function to call.

dispatchEvent(event, applyTargetopt)

Fires the given Event.

Parameters:
Name Type Attributes Default Description
event Event

The Event to fire.

applyTarget Boolean <optional>
false

Set this instance as the Events target. Default is false.

removeEventListener(type, listenerMethod, listenerObject) → {Boolean}

Removes a listener

Parameters:
Name Type Description
type String

The type of Event

listenerMethod String

The method to remove

listenerObject Object

The Object that contains the method.

Returns:

Returns true if a listener was removed.

Type
Boolean