- // Send my current live games (if any)
- // TODO: from indexedDB, through GameStorage.
-// if (!!localStorage["gid"])
-// {
-// const myGame =
-// {
-// // Minimal game informations: (fen+clock not required)
-// id: localStorage["gid"],
-// players: JSON.parse(localStorage["players"]), //array sid+id+name
-// vname: localStorage["vname"],
-// timeControl: localStorage["timeControl"],
-// };
-// this.st.conn.send(JSON.stringify({code:"game",
-// game:myGame, target:data.from}));
-// }
+ // Send my current live game (if any)
+ GameStorage.getCurrent((game) => {
+ if (!!game)
+ {
+ const myGame =
+ {
+ // Minimal game informations:
+ id: game.id,
+ players: game.players.map(p => p.name),
+ vname: game.vname,
+ timeControl: game.timeControl,
+ };
+ this.st.conn.send(JSON.stringify({code:"game",
+ game:myGame, target:data.from}));
+ }
+ });