-
addEventListener(type, fn [, options])
-
Add a handler to the given event name
Parameters:
Name |
Type |
Argument |
Description |
type |
string
|
number
|
|
The name of the event to listen to |
fn |
function
|
|
The handler to be called when the event is triggered |
options |
object
|
<optional>
|
Optional options object for addEventListener
Properties
Name |
Type |
Description |
once |
boolean
|
If true then the handler will be called only once |
|
- Inherited From:
-
Returns:
Returns the object that 'addEventListener' is being called on
-
Type
-
object
Example
myObject.addEventListener('eventName', (eventParameter1, eventParameter2) => {
...
});
-
canRedo()
-
Returns whether there is a change available to redo
Returns:
Whether there is a change that can be redone or not
-
Type
-
boolean
-
canUndo()
-
Returns whether there is a change available to undo
Returns:
Whether there is a change that can be undone or not
-
Type
-
boolean
-
clear()
-
Clears the undo/redo history so that no older changes can be undone.
-
redo()
-
Reapplies the most recent annotation change that was undone
Returns:
Returns a promise that resolves when the operation is complete
-
Type
-
Promise.<void>
-
removeEventListener( [type] [, fn])
-
Remove a handler of the given event name and namespace (if given) or with a function reference
Parameters:
Name |
Type |
Argument |
Description |
type |
string
|
number
|
<optional>
|
The name of the event to remove the handler of with an optional namespace. |
fn |
function
|
<optional>
|
The handler associated with this event to be removed.
If fn is undefined, all the handlers of the given event namespace will be removed.
If you are not passing in this parameter then a namespace must be used with the event name. |
- Inherited From:
-
Returns:
Returns the object that 'removeEventListener' is being called on
-
Type
-
object
Example
myObject.removeEventListener('eventName.namespace');
myObject.removeEventListener('eventName', fn);
-
trigger(type [, data])
-
Calls the handlers of the event name with given data
Parameters:
Name |
Type |
Argument |
Description |
type |
string
|
number
|
|
event name of which the handlers will be called. |
data |
*
|
<optional>
|
data that will be passed to the handlers.
If data is an array, it will be spread and then passed to the handlers |
- Inherited From:
-
Returns:
Returns the object that 'trigger' is being called on
-
Type
-
object
Example
myObject.trigger('eventName');
myObject.trigger('eventName', [eventParameter1, eventParameter2]);
-
undo()
-
Undoes the most recent annotation change
Returns:
Returns a promise that resolves when the operation is complete
-
Type
-
Promise.<void>