new EventDispatcher()
Base class for any (non HTMLElement) object which dispatches or listens for events
Methods
-
_triggerListeners()
-
Handles the logic of triggering listeners
-
addEventListener(type, callback [, thisObject] [, useCapture])
-
Adds an event listener on this object
Parameters:
Name Type Argument Description typestring The event type, or multiple types separated by spaces callbackfunction The callback to call when the event fires thisObjectobject <optional>
The object to use as "this" when firing the callback useCapturebool <optional>
If true, fires the callback on the capture phase, as opposed to bubble phase -
dispatchEvent(event)
-
Fires an event on this object
Parameters:
Name Type Description eventstring | WPGMZA.Event Either the event type as a string, or an instance of WPGMZA.Event -
hasEventListener(type)
-
Test for listeners of type on this object
Parameters:
Name Type Description typestring The event type to test for Returns:
True if this object has listeners bound for the specified type- Type
- bool
-
off()
-
Alias for removeEventListener
-
on()
-
Alias for addEventListener
-
removeEventListener(type [, listener] [, thisObject] [, useCapture])
-
Removes event listeners from this object
Parameters:
Name Type Argument Description typestring The event type to remove listeners from listenerfunction <optional>
The function to remove. If omitted, all listeners will be removed thisObjectobject <optional>
Use the parameter to remove listeners bound with the same thisObject useCapturebool <optional>
Remove the capture phase event listener. Otherwise, the bubble phase event listener will be removed. -
trigger()
-
Alias for removeEventListener