X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Futils%2FgameStorage.js;h=4eb6bc730ed71fe10ec382145793fc45d97cb173;hp=ce609af09ad8fdcc1fe93e1fa88d47930490d979;hb=db1f1f9adb920605c7a16b060a7737e54636ee08;hpb=e891730f77312340d68bb7ef72a4207541fa3914 diff --git a/client/src/utils/gameStorage.js b/client/src/utils/gameStorage.js index ce609af0..4eb6bc73 100644 --- a/client/src/utils/gameStorage.js +++ b/client/src/utils/gameStorage.js @@ -96,7 +96,8 @@ export const GameStorage = { }, // Retrieve all local games (running, completed, imported...) - getAll: function(callback) { + // light: do not retrieve moves or players or clocks (TODO: this is the only usage) + getAll: function(light, callback) { dbOperation((err,db) => { let objectStore = db.transaction("games").objectStore("games"); let games = []; @@ -104,7 +105,15 @@ export const GameStorage = { let cursor = event.target.result; // if there is still another cursor to go, keep running this code if (cursor) { - games.push(cursor.value); + let g = cursor.value; + if (light) { + g.movesCount = g.moves.length; + delete g.moves; + delete g.clocks; + delete g.initime; + delete g.players; + } + games.push(g); cursor.continue(); } else callback(games); };