JSUTILS.EventDispatcher Class
The EventDispatcher class mimics the DOM event dispatcher model so the user can add and remove event listeners in a familiar way. Event bubbling is not available because events are dispatched in relation to state changes of physical components instead of layered graphics so there is nothing to bubble up.
Constructor
JSUTILS.EventDispatcher
(
-
target
Parameters:
-
target
ClassThe instance of the class that implements EventDispatcher
Item Index
Methods
addEventListener
(
-
type
-
listener
Parameters:
-
type
StringThe event type
-
listener
FunctionThe function to be called when the event is fired
dispatchEvent
(
-
type
-
optionalParams
Parameters:
-
type
EventThe Event object.
-
optionalParams
ObjectOptional parameters passed as an object. return {boolean} True if dispatch is successful, false if not.
hasEventListener
(
-
type
Parameters:
-
type
StringThe event type return {boolean} True is listener exists for this type, false if not.
removeEventListener
(
-
type
-
listener
Parameters:
-
type
StringThe event type
-
listener
FunctionThe function to be called when the event is fired