File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ class Manager {
125
125
window . addEventListener ( "focus" , this . window . windowFocus . bind ( this . window ) ) ;
126
126
window . addEventListener ( "statechange" , this . app . stateChange . bind ( this . app ) ) ;
127
127
window . addEventListener ( "popstate" , this . app . popState . bind ( this . app ) ) ;
128
+ window . addEventListener ( "message" , this . input . handlePostMessage . bind ( this . input ) ) ;
128
129
129
130
// Controls
130
131
document . getElementById ( "bake" ) . addEventListener ( "click" , this . controls . bakeClick . bind ( this . controls ) ) ;
Original file line number Diff line number Diff line change @@ -1654,6 +1654,22 @@ class InputWaiter {
1654
1654
this . changeTab ( inputNum , this . app . options . syncTabs ) ;
1655
1655
}
1656
1656
1657
+ /**
1658
+ * Handler for incoming postMessages
1659
+ * If the events data has a `type` property set to `dataSubmit`
1660
+ * the value property is set to the current input
1661
+ * @param {event } e
1662
+ * @param {object } e.data
1663
+ * @param {string } e.data.type - the type of request, currently the only value is "dataSubmit"
1664
+ * @param {string } e.data.value - the value of the message
1665
+ */
1666
+ handlePostMessage ( e ) {
1667
+ if ( "data" in e && "type" in e . data && "value" in e . data ) {
1668
+ if ( e . data . type === "dataSubmit" ) {
1669
+ this . setInput ( e . data . value ) ;
1670
+ }
1671
+ }
1672
+ }
1657
1673
}
1658
1674
1659
1675
export default InputWaiter ;
You can’t perform that action at this time.
0 commit comments