X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=blobdiff_plain;f=tictactoe%2Ftictactoe.jsx;h=25c8a9f887742312c4537fca678823628be1190d;hp=934faa8e0cc63e37adc530c22beea642f7782fb7;hb=4e9bfe84b21940998e45ad8dd79769df5dfed3ee;hpb=d1b224fb4410e5ae5a06a5a8edc707524f1c2b73 diff --git a/tictactoe/tictactoe.jsx b/tictactoe/tictactoe.jsx index 934faa8..25c8a9f 100644 --- a/tictactoe/tictactoe.jsx +++ b/tictactoe/tictactoe.jsx @@ -25,6 +25,16 @@ events.addEventListener("move", event => { window.game.receiveMove(square); }); +events.addEventListener("game-state", event => { + const state = JSON.parse(event.data); + + window.game.resetState(); + + for (let square of state.moves) { + window.game.receiveMove(square); + } +}); + function Square(props) { return (