From: Benjamin Auder Date: Sat, 4 Apr 2020 17:43:27 +0000 (+0200) Subject: 'update' X-Git-Url: https://git.auder.net/pieces/current/img/js/rpsls.js?a=commitdiff_plain;h=cc25444a44669a7deb6c096c1195f320d17590a1;p=vchess.git 'update' --- diff --git a/client/src/utils/compgameStorage.js b/client/src/utils/compgameStorage.js index 655fd6bf..4f5181ef 100644 --- a/client/src/utils/compgameStorage.js +++ b/client/src/utils/compgameStorage.js @@ -55,7 +55,7 @@ export const CompgameStorage = { .objectStore("compgames"); objectStore.get(gameId).onsuccess = function(event) { // Ignoring error silently: shouldn't happen now. TODO? - if (event.target.result) { + if (!!event.target.result) { const game = event.target.result; Object.keys(obj).forEach(k => { if (k == "move") game.moves.push(obj[k]); diff --git a/client/src/utils/gameStorage.js b/client/src/utils/gameStorage.js index 99206ede..6885ed15 100644 --- a/client/src/utils/gameStorage.js +++ b/client/src/utils/gameStorage.js @@ -73,14 +73,13 @@ export const GameStorage = { // obj: chat, move, fen, clocks, score[Msg], initime, ... update: function(gameId, obj) { - // live dbOperation((err, db) => { let objectStore = db .transaction("games", "readwrite") .objectStore("games"); objectStore.get(gameId).onsuccess = function(event) { // Ignoring error silently: shouldn't happen now. TODO? - if (event.target.result) { + if (!!event.target.result) { let game = event.target.result; // Hidden tabs are delayed, to prevent multi-updates: if (obj.moveIdx < game.moves.length) return;