on EDITOR
¶
on API is used to register event listener for a specific event.
Syntax¶
on(listener : function, event : String)
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import INKAPI from './inkapi.js'
INKAPI.ready(async () => {
const EDITOR = INKAPI.editor;
const contentChangeHandler = (data) => {
console.log(data);
}
//subscribing to an event with event handler
EDITOR.on(contentChangeHandler, "contentChange")
});
|
Parameters¶
Name |
Type |
Description |
---|---|---|
listener |
|
Required. Specifies the function to run when the event occurs. |
event |
|
Required. A String that specifies the name of the event. |
Events¶
Following events are available for plugins to subscribe to;
Event |
Description |
---|---|
contentChange |
This event is triggered every time the INK editor content is changed. |