EventDispatcher()

Other classes can inherit from this class in order to provide an event based API. Useful for controls development.

new EventDispatcher()

Constructs a new event dispatcher.

Author:

Methods

addEventListener(type, listener)

Adds an event listener for the given event type.

Parameters:
Name Type Description
type String

The event type.

listener function

The event listener to add.

dispatchEvent(event)

Dispatches an event to all respective event listeners.

Parameters:
Name Type Description
event Object

The event object.

hasEventListener(type, listener) → {Boolean}

Returns true if the given event listener is set for the given event type.

Parameters:
Name Type Description
type String

The event type.

listener function

The event listener to test.

Returns:
Boolean -

Whether the given event listener is set for the given event type or not.

removeEventListener(type, listener)

Removes the given event listener for the given event type.

Parameters:
Name Type Description
type String

The event type.

listener function

The event listener to remove.