fix gameStop undefined error when refreshing page

This commit is contained in:
Evan
2024-12-03 20:04:00 -08:00
parent a0a40262a6
commit ec155dcb84
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -32,7 +32,9 @@ class Client {
const s = this.stopGame
window.addEventListener('beforeunload', function (event) {
console.log('Browser is closing');
s()
if (s != null) {
s()
}
});
setFavicon()
@@ -84,9 +86,7 @@ class Client {
}
private stopGame() {
if (this.gameStop != null) {
this.gameStop()
}
this?.gameStop?.()
}
private async handleLeaveLobby(event: CustomEvent) {