add event listener to game on session destructuring
This commit is contained in:
parent
a961c87e96
commit
674aad81fe
@ -235,6 +235,8 @@ export default class Session extends EventTarget {
|
|||||||
throw new TypeError("struct must contain currentGame as object");
|
throw new TypeError("struct must contain currentGame as object");
|
||||||
if (value.currentGame !== null) {
|
if (value.currentGame !== null) {
|
||||||
this.#currentGame = new Game(value.currentGame);
|
this.#currentGame = new Game(value.currentGame);
|
||||||
|
this.#currentGame.addEventListener(
|
||||||
|
Game.EVENT_CHANGE, this.#boundHandleGameChange);
|
||||||
if (this.#currentGame.result.winner !== null)
|
if (this.#currentGame.result.winner !== null)
|
||||||
throw new Error("currentGame in struct must not be finished");
|
throw new Error("currentGame in struct must not be finished");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user