diff --git a/frontend/static/js/views/GameOfflineView.js b/frontend/static/js/views/GameOfflineView.js index 62c3066..a7dc96e 100644 --- a/frontend/static/js/views/GameOfflineView.js +++ b/frontend/static/js/views/GameOfflineView.js @@ -19,6 +19,10 @@ export default class extends AbstractView { document.getElementById('stopGameButton').onclick = this.stopGame.bind(this); } + async leavePage() { + this.game?.cleanup(); + } + startGame() { if (this.game == null) { document.getElementById('startGameButton').innerHTML = 'Reset Game'; @@ -26,6 +30,7 @@ export default class extends AbstractView { } else { document.getElementById('app').removeChild(this.game.canvas); + document.getElementById('app').removeChild(this.game.scoresDisplay); this.game.cleanup(); this.game = new Game; }