Constructor
new SimpleEventDispatcher()
Default constructor.
- Source:
Classes
Methods
(private, static) processType(type)
Utility function to validate an event type string, and convert it to a consistent case.
Parameters:
| Name | Type | Description |
|---|---|---|
type |
string | An event type string. |
- Source:
Throws:
-
-
If type is not defined or is a zero-length string.
- Type
- ReferenceError
-
-
-
If type is not a string.
- Type
- TypeError
-
Returns:
The given type converted to a consistent case.
addEventListener(type, listener, useCaptureopt)
Adds the given listener for the given event type, provided it is not already registered for that type.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
type |
string | Event type for which the given |
||
listener |
SimpleEventListener | function | Listener to register. |
||
useCapture |
boolean |
<optional> |
false | Optional parameter added for consistency with the standard DOM |
- Source:
Throws:
-
-
If
typeis not defined or is a zero-length string; iflisteneris not defined. - Type
- ReferenceError
-
-
-
If type is not a
string; iflistenerdoes not implement SimpleEventListener or is not a function. - Type
- TypeError
-
dispatchEvent(event)
Dispatches the given event to registered listeners. Listeners are called in the order they are added.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
SimpleEventIntf | Event to dispatch. |
- Source:
Throws:
-
-
If
eventis not defined. - Type
- ReferenceError
-
-
-
If
eventdoes not implement SimpleEventIntf. - Type
- TypeError
-
removeEventListener(type, listener, useCaptureopt)
Removes the given listener for the given event type, provided it is currently registered for that type.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
type |
string | Event type for which the given |
||
listener |
SimpleEventListener | function | Listener to be removed. |
||
useCapture |
boolean |
<optional> |
false | Optional parameter added for consistency with the standard DOM |
- Source:
Throws:
-
-
If
typeis not defined or is a zero-length string. - Type
- ReferenceError
-
-
-
If
typeis not a string. - Type
- TypeError
-