fix: 使用beforeunload事件

This commit is contained in:
unanmed 2024-02-02 21:03:29 +08:00
parent ac5603f2f5
commit 6c8104e39e
2 changed files with 2 additions and 2 deletions

View File

@ -376,7 +376,7 @@ CustomToolbar.register(
} }
); );
window.addEventListener('unload', () => { window.addEventListener('beforeunload', () => {
CustomToolbar.save(); CustomToolbar.save();
}); });
window.addEventListener('blur', () => { window.addEventListener('blur', () => {

View File

@ -98,7 +98,7 @@ export class GameStorage<T extends object = any> {
} }
} }
window.addEventListener('unload', () => { window.addEventListener('beforeunload', () => {
GameStorage.list.forEach(v => v.write()); GameStorage.list.forEach(v => v.write());
}); });
window.addEventListener('blur', () => { window.addEventListener('blur', () => {