1
0

add event listener to game on session destructuring

This commit is contained in:
Adrian Wannenmacher 2026-02-18 19:00:40 +01:00
parent a961c87e96
commit 674aad81fe
Signed by: tfld
GPG Key ID: 19D986ECB1E492D5

View File

@ -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");
} }