# Two.Events
Object inherited by many Two.js objects in order to facilitate custom events.
# addEventListener
Two.Events.addEventListener
Argument | Description |
---|---|
name | The name of the event to bind a function to. |
handler | The function to be invoked when the event is dispatched. |
Call to add a listener to a specific event name.
# removeEventListener
Two.Events.removeEventListener
Argument | Description |
---|---|
name | The name of the event intended to be removed. |
handler | The handler intended to be removed. |
Call to remove listeners from a specific event. If only name
is passed then all the handlers attached to that name
will be removed. If no arguments are passed then all handlers for every event on the obejct are removed.
# dispatchEvent
Two.Events.dispatchEvent
Argument | Description |
---|---|
name | The name of the event to dispatch. |
args | Anything can be passed after the name and those will be passed on to handlers attached to the event in the order they are passed. |
Call to trigger a custom event. Any additional arguments passed after the name will be passed along to the attached handlers.