EventDispatcher

JavaScript events for custom objects.

Constructor

new EventDispatcher()

Methods

addEventListener(type, listener)

Adds a listener to an event type.

Parameters:
NameTypeDescription
typestring

The type of event to listen to.

listenerfunction

The function that gets called when the event is fired.

dispatchEvent(event)

Fire an event.

Parameters:
NameTypeDescription
eventobject

The event that gets fired.

removeEventListener(type, listener)

Removes a listener from an event type.

Parameters:
NameTypeDescription
typestring

The type of the listener that gets removed.

listenerfunction

The listener function that gets removed.