This topic describes how to listen to events, view the event names, and view the current SDK version.
View events that can be listened to
You can use Events to view the names of all events that can be listened to.
Example:
async function example() {
await instance.ready();
const events = await instance.Events;
console.log(events);
}Listen to events
You can use on()to listen to events, such as the document saving event, and then further process the information.
Example:
async function example() {
await instance.ready();
instance.on('fileSaved', (e) => console.log(e));
}Stop listening to events
You can use off() to stop listening to events.
Example:
async function example() {
await instance.ready();
await instance.off('response', (e) => console.log(e));
}View the current SDK version
You can use version to view the current SDK version.
Example:
async function example() {
await instance.ready();
const version = await instance.version;
console.log(version);
}View the document URL
You can use url to view the actual path of the document, which is the value of url nested in iframe.
Example:
async function example() {
await instance.ready();
const url = await instance.url;
console.log(url);
}Obtain the current iframe object
You can use iframe to obtain the iframe object of the current document.
Example:
async function example() {
await instance.ready();
const iframe = await instance.iframe;
console.log(iframe);
}该文章对您有帮助吗?