mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-07-02 21:11:51 +08:00
Refactor PWA state management to simplify and streamline implementation
Co-authored-by: jxxghp <jxxghp@163.com>
This commit is contained in:
@@ -146,14 +146,9 @@ if (pwaStateController) {
|
||||
}
|
||||
|
||||
// 6. 初始化后台优化工具
|
||||
console.log('初始化后台优化工具...')
|
||||
|
||||
// 将后台管理器绑定到全局对象(便于调试)
|
||||
if (import.meta.env.MODE === 'development') {
|
||||
;(window as any).backgroundManager = backgroundManager
|
||||
;(window as any).sseManagerSingleton = sseManagerSingleton
|
||||
|
||||
// 添加全局调试函数
|
||||
;(window as any).debugBackground = () => {
|
||||
console.table(backgroundManager.getTimersInfo())
|
||||
console.log('Background Status:', backgroundManager.getStatus())
|
||||
@@ -162,11 +157,9 @@ if (import.meta.env.MODE === 'development') {
|
||||
|
||||
// 页面卸载时清理后台管理器
|
||||
window.addEventListener('beforeunload', () => {
|
||||
console.log('应用卸载,清理后台资源...')
|
||||
backgroundManager.destroy()
|
||||
sseManagerSingleton.closeAllManagers()
|
||||
|
||||
// 清理PWA状态管理器
|
||||
if (pwaStateController) {
|
||||
pwaStateController.destroy()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user