Add event listener for message events

Add handler for message events
This commit is contained in:
ken 2025-02-28 19:44:04 +00:00
parent bf36fe8143
commit 7710c5ef49
2 changed files with 17 additions and 0 deletions

View file

@ -1654,6 +1654,22 @@ class InputWaiter {
this.changeTab(inputNum, this.app.options.syncTabs);
}
/**
* Handler for incoming postMessages
* If the events data has a `type` property set to `dataSubmit`
* the value property is set to the current input
* @param {event} e
* @param {object} e.data
* @param {string} e.data.type - the type of request, currently the only value is "dataSubmit"
* @param {string} e.data.value - the value of the message
*/
handlePostMessage(e) {
if ("data" in e && "type" in e.data && "value" in e.data) {
if (e.data.type === "dataSubmit") {
this.setInput(e.data.value);
}
}
}
}
export default InputWaiter;