// Game object: {
// // Static informations:
-// gameId: string
+// id: string
// vname: string,
// fenStart: string,
// players: array of sid+id+name,
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
}
}
else
{
// Local or corr game
- GameStorage.get(this.gameRef.id, (game) => {
- afterRetrieval(game);
- });
+ GameStorage.get(this.gameRef.id, afterRetrieval);
}
},
// Post-process a move (which was just played)
else
{
this.infoMessage = "New game started: " +
- "<a href='#/game/" + data.gameInfo.gameId + "'>" +
- "#/game/" + data.gameInfo.gameId + "</a>";
+ "<a href='#/game/" + data.gameInfo.id + "'>" +
+ "#/game/" + data.gameInfo.id + "</a>";
let modalBox = document.getElementById("modalInfo");
modalBox.checked = true;
setTimeout(() => { modalBox.checked = false; }, 3000);
// These game informations will be sent to other players
const gameInfo =
{
- gameId: getRandString(),
+ id: getRandString(),
fen: c.fen || V.GenRandInitFen(),
players: shuffle([c.from, c.seat]), //white then black
vid: c.vid,
"POST",
{gameInfo: gameInfo, cid: c.id}, //cid useful to delete challenge
response => {
- gameInfo.gameId = response.gameId;
+ gameInfo.id = response.gameId;
tryNotifyOpponent();
this.$router.push("/game/" + response.gameId);
}
GameStorage.add(game);
if (this.st.settings.sound >= 1)
new Audio("/sounds/newgame.mp3").play().catch(err => {});
- this.$router.push("/game/" + gameInfo.gameId);
+ this.$router.push("/game/" + gameInfo.id);
},
},
};