Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/web/Manager.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class Manager {
window.addEventListener("focus", this.window.windowFocus.bind(this.window));
window.addEventListener("statechange", this.app.stateChange.bind(this.app));
window.addEventListener("popstate", this.app.popState.bind(this.app));
window.addEventListener("message", this.input.handlePostMessage.bind(this.input));

// Controls
document.getElementById("bake").addEventListener("click", this.controls.bakeClick.bind(this.controls));
Expand Down
17 changes: 17 additions & 0 deletions src/web/waiters/InputWaiter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1654,6 +1654,23 @@ 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) {
log.debug(e);
if ("data" in e && "id" in e.data && "value" in e.data) {
if (e.data.id === "setInput") {
this.setInput(e.data.value);
}
}
}
}

export default InputWaiter;
Loading