EventDispatcher Class
A base class for adding and removing event listeners and dispatching events.
Constructor
EventDispatcher
()
Item Index
Properties
Methods
addEventListener
(
-
type -
listener
Adds an event listener.
Parameters:
-
typeString- The event type.
-
listenerFunction- The event listener.
apply
(
-
object
Extends an object with the event dispatcher functionality.
Parameters:
-
objectObject- The object.
Example:
EventDispatcher.prototype.apply(X.prototype);
dispatchEvent
(
-
event
Dispatches an event to all respective listeners.
Parameters:
-
eventObject- The event.
hasEventListener
(
-
type -
listener
Checks if the event listener exists.
Parameters:
-
typeString- The event type.
-
listenerFunction- The event listener.
removeEventListener
(
-
type -
listener
Removes an event listener.
Parameters:
-
typeString- The event type.
-
listenerFunction- The event listener.
Properties
_listeners
Object
private
A map of listeners.
