X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=blobdiff_plain;f=tictactoe%2Ftictactoe.jsx;h=17c966dc9453a2ffebdb2581b7a696be9ba691b0;hp=849a6f2a113f6141ceaf1e33927bb10d2bbadd23;hb=0edb467eb1b8922d885ef6a756fca68c9d2d0a08;hpb=49cb71f5d7657c00ece637a6a08dcd763b113653 diff --git a/tictactoe/tictactoe.jsx b/tictactoe/tictactoe.jsx index 849a6f2..17c966d 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 (