Function
saveToStorage
(windows: Record<string, WindowState>, activeId: string | null, maxZ: number)
Source from the content-addressed store, hash-verified
| 25 | } |
| 26 | |
| 27 | function saveToStorage(windows: Record<string, WindowState>, activeId: string | null, maxZ: number) { |
| 28 | try { |
| 29 | localStorage.setItem(STORAGE_KEY, JSON.stringify({ |
| 30 | windows, |
| 31 | activeId, |
| 32 | maxZ |
| 33 | })) |
| 34 | } catch { |
| 35 | // ignore storage errors |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | export const useWindowStore = defineStore('window', () => { |
| 40 | // 页面加载时从 localStorage 恢复窗口状态 |
Tested by
no test coverage detected