From dd8131e55a494ecab9443ccfa57c7e96537b20ce Mon Sep 17 00:00:00 2001 From: lagaffe <> Date: Tue, 30 Jun 2026 17:03:23 +0200 Subject: [PATCH] fix a bug where time could go in negatives after a restart --- src/games/timedGame.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/games/timedGame.js b/src/games/timedGame.js index 21f80a3..b4bc62d 100644 --- a/src/games/timedGame.js +++ b/src/games/timedGame.js @@ -20,7 +20,7 @@ export class TimedGame extends Game { super.start(); this.timerDisplay.start(); this._timeoutStartTime = Date.now(); - this._timeoutId = setInterval(() => { + this._timeoutId = setTimeout(() => { this._onTimeout(); }, this.baseTimeout); } @@ -34,7 +34,7 @@ export class TimedGame extends Game { this._onTimeout(); } else { this._timeoutStartTime = Date.now(); - this._timeoutId = setInterval(() => { + this._timeoutId = setTimeout(() => { this._onTimeout(); }, this.currentTimeout); } @@ -46,6 +46,7 @@ export class TimedGame extends Game { clearTimeout(this._timeoutId); this._timeoutId = undefined; this._timeoutStartTime = undefined; + this.currentTimeout = this.baseTimeout; } end(status) {