From 2cd931097461eeb26d97bb7c3b1652e333a2848d Mon Sep 17 00:00:00 2001 From: Klemek Date: Fri, 18 Oct 2024 18:51:49 +0200 Subject: [PATCH] try to nice unload on phones --- main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 239105f..81749c5 100644 --- a/main.js +++ b/main.js @@ -183,11 +183,12 @@ let app = { const self = this; setTimeout(this.showApp); this.loadSounds(); - document.addEventListener("visibilitychange", function () { + document.addEventListener("visibilitychange", () => { if (!document.hidden) { self.onFocus(); } }); + document.addEventListener("beforeunload", self.onFocus); }, };