new eventHandler()
Methods
-
off(eventName [, handler])
-
Remove an event handler
Parameters:
Name Type Argument Description eventName
string The name of the event to remove the handler for
handler
function <optional>
The handler associated with this event to be removed
Returns:
Returns the object that 'off' is being called on.
- Type
- object
-
on(eventName, handler)
-
Add an event handler
Parameters:
Name Type Description eventName
string The name of the event to listen to
handler
function The function to be called when the event is triggered
Returns:
Returns the object that 'on' is being called on.
- Type
- object
-
one(eventName, handler)
-
Add an event handler that will be removed automatically after being handled the first time
Parameters:
Name Type Description eventName
string The name of the event to listen to
handler
function The function to be called when the event is triggered
Returns:
Returns the object that 'one' is being called on.
- Type
- object
-
trigger(eventName, eventParams)
-
Trigger an event
Parameters:
Name Type Description eventName
string The name of the event to trigger
eventParams
array Parameters associated with the event
Returns:
Returns the object that 'trigger' is being called on.
- Type
- object
Example
annotManager.trigger('annotationChanged', [[annotation], 'modify']);