mirror of
https://github.com/aquatix/alfagok.git
synced 2025-12-06 22:15:11 +01:00
Reset game state when new/different game has started
This commit is contained in:
@@ -35,6 +35,9 @@ document.addEventListener('alpine:init', () => {
|
|||||||
console.log(result);
|
console.log(result);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (result.game) {
|
if (result.game) {
|
||||||
|
if (this.gameID !== result.game) {
|
||||||
|
this.setEmptyGameState();
|
||||||
|
}
|
||||||
return this.gameID = result.game;
|
return this.gameID = result.game;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -116,10 +119,6 @@ document.addEventListener('alpine:init', () => {
|
|||||||
|
|
||||||
this.getGameID();
|
this.getGameID();
|
||||||
},
|
},
|
||||||
// # Local Storage Persistence
|
|
||||||
resetSavedGames() {
|
|
||||||
localStorage.removeItem(this.savedGameKey);
|
|
||||||
},
|
|
||||||
// # Countdown timer
|
// # Countdown timer
|
||||||
getFormattedTime(milliseconds) {
|
getFormattedTime(milliseconds) {
|
||||||
if (!Number.isInteger(milliseconds)) {
|
if (!Number.isInteger(milliseconds)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user