Enhance PWA state management with advanced scroll, form, and modal tracking

Co-authored-by: jxxghp <jxxghp@163.com>
This commit is contained in:
Cursor Agent
2025-07-06 23:03:42 +00:00
parent 325cce5f82
commit 8824869cd1
4 changed files with 1399 additions and 8 deletions

View File

@@ -136,6 +136,13 @@ if (pwaStateController) {
pwaStateController.saveCurrentState()
}
})
// 监听页面隐藏事件,保存状态
document.addEventListener('visibilitychange', () => {
if (document.hidden && pwaStateController) {
pwaStateController.saveCurrentState()
}
})
}
// 6. 初始化后台优化工具
@@ -158,6 +165,11 @@ window.addEventListener('beforeunload', () => {
console.log('应用卸载,清理后台资源...')
backgroundManager.destroy()
sseManagerSingleton.closeAllManagers()
// 清理PWA状态管理器
if (pwaStateController) {
pwaStateController.destroy()
}
})
// 导出状态管理器供其他模块使用