new EventHandler()
- See:
Methods
add(event, handler)
Add an event handler for a specific event
Parameters:
Name | Type | Description |
---|---|---|
event |
String | Event name |
handler |
function | A event handler function |
remove(event, handleropt)
Remove an event handler of a specific event name or remove all event handlers for a specific event.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
event |
String | The event name where a specific or all handlers should be removed |
|
handler |
function |
<optional> |
An optional event handler function. If specified only this specific handler will be removed and otherwise all handlers are removed. |
trigger(event, data)
Use this function to trigger an event. All handlers that are listening for this event will be triggered with the data parameter.
Parameters:
Name | Type | Description |
---|---|---|
event |
String | The event name that should be triggered |
data |
* | Arbitrary data that will be passed to the event handler callback functions |