X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Futils%2FgameStorage.js;h=630d1c759e2500de9c56ae3bfb94d5ea3726fa6c;hb=dcd68c4108412f45b8ce119ae80ce8f6e296800b;hp=dc653794d36a2b567371efed97013d134e29adc9;hpb=92b82defacccf9c4d3755924a71fcb584002ccc6;p=vchess.git diff --git a/client/src/utils/gameStorage.js b/client/src/utils/gameStorage.js index dc653794..630d1c75 100644 --- a/client/src/utils/gameStorage.js +++ b/client/src/utils/gameStorage.js @@ -1,6 +1,6 @@ // Game object: { // // Static informations: -// gameId: string +// id: string // vname: string, // fenStart: string, // players: array of sid+id+name, @@ -39,7 +39,7 @@ function dbOperation(callback) alert("Error while loading database: " + event.target.errorCode); }; // Create objectStore for vchess->games - let objectStore = db.createObjectStore("games", { keyPath: "gameId" }); + let objectStore = db.createObjectStore("games", { keyPath: "id" }); objectStore.createIndex("score", "score"); //to search by game result } } @@ -67,7 +67,8 @@ export const GameStorage = }, // TODO: also option to takeback a move ? - update: function(gameId, obj) //move, fen, clocks, score, initime, ... + // obj: chat, move, fen, clocks, score[Msg], initime, ... + update: function(gameId, obj) { if (Number.isInteger(gameId) || !isNaN(parseInt(gameId))) { @@ -79,9 +80,12 @@ export const GameStorage = gid: gameId, newObj: { + chat: obj.chat, move: obj.move, //may be undefined... fen: obj.fen, score: obj.score, + scoreMsg: obj.scoreMsg, + drawOffer: obj.drawOffer, } } );