Compare commits
2 Commits
0b7a24a75b
...
923a67dc7b
| Author | SHA1 | Date | |
|---|---|---|---|
| 923a67dc7b | |||
| d4ad184324 |
@@ -270,6 +270,11 @@ function startGame(seed) {
|
||||
|
||||
// ── Timer ────────────────────────────────────────────────────────────────────
|
||||
function startTimer() {
|
||||
// Idempotent: never stack a second interval. The visibilitychange handler
|
||||
// and startGame can both call this, and a stray call (e.g. a load-time
|
||||
// visibilitychange while a timer is already running) would otherwise leak
|
||||
// the old interval and make elapsedSecs increment twice per second.
|
||||
if (timerInterval) return;
|
||||
timerInterval = setInterval(() => {
|
||||
elapsedSecs++;
|
||||
updateTimerDisplay();
|
||||
|
||||
Reference in New Issue
Block a user