From 6c8104e39e0052718f48da2dd1028a5181646c90 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Fri, 2 Feb 2024 21:03:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BD=BF=E7=94=A8beforeunload=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/main/custom/toolbar.ts | 2 +- src/core/main/storage.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/main/custom/toolbar.ts b/src/core/main/custom/toolbar.ts index a289aad..f28444c 100644 --- a/src/core/main/custom/toolbar.ts +++ b/src/core/main/custom/toolbar.ts @@ -376,7 +376,7 @@ CustomToolbar.register( } ); -window.addEventListener('unload', () => { +window.addEventListener('beforeunload', () => { CustomToolbar.save(); }); window.addEventListener('blur', () => { diff --git a/src/core/main/storage.ts b/src/core/main/storage.ts index ba7270c..2f56fbc 100644 --- a/src/core/main/storage.ts +++ b/src/core/main/storage.ts @@ -98,7 +98,7 @@ export class GameStorage { } } -window.addEventListener('unload', () => { +window.addEventListener('beforeunload', () => { GameStorage.list.forEach(v => v.write()); }); window.addEventListener('blur', () => {