X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Futils%2Fstorage.js;h=e5978ae3e33f5f3d42ef48e56a1911b0c30a9623;hp=a30bb824e964b70ce855c973d1fefeac3b4e87d4;hb=c4f91d3ff756bf1c8948433e0584e0e4235f3524;hpb=8a7452b520dc7ead6880a7e62e7c0e057db1ebda diff --git a/client/src/utils/storage.js b/client/src/utils/storage.js index a30bb824..e5978ae3 100644 --- a/client/src/utils/storage.js +++ b/client/src/utils/storage.js @@ -116,15 +116,15 @@ export const GameStorage = // localStorage: // TODO: also option to takeback a move ? // NOTE: for live games only (all on server for corr) - update: function(o) //colorIdx, move, fen, elapsed, increment, initime, score + update: function(o) //colorIdx, move, fen, addTime, initime, score { let gameState = JSON.parse(localStorage.getItem("gameState")); if (!!o.move) { gameState.moves.push(o.move); gameState.fen = o.fen; - if (!!o.elapsed) //NaN if first move in game - gameState.clocks[o.colorIdx] += (o.increment - o.elapsed); + if (!!o.addTime) //NaN if first move in game + gameState.clocks[o.colorIdx] += o.addTime; } if (!!o.initime) //just a flag (true) gameState.initime = Date.now();