(e: StorageEvent)
| 229 | const loadThemes = () => Promise.all(themeIDs().map(load)).then(() => store.themes) |
| 230 | |
| 231 | const onStorage = (e: StorageEvent) => { |
| 232 | if (e.key === STORAGE_KEYS.THEME_ID && e.newValue) { |
| 233 | const next = normalize(e.newValue) |
| 234 | if (!next) return |
| 235 | if (next !== "oc-2" && !knownThemes().has(next) && !store.themes[next]) return |
| 236 | setStore("themeId", next) |
| 237 | if (next === "oc-2") { |
| 238 | clear() |
| 239 | return |
| 240 | } |
| 241 | void load(next).then((theme) => { |
| 242 | if (!theme || store.themeId !== next) return |
| 243 | cacheThemeVariants(theme, next) |
| 244 | }) |
| 245 | } |
| 246 | if (e.key === STORAGE_KEYS.COLOR_SCHEME && e.newValue) { |
| 247 | setStore("colorScheme", e.newValue as ColorScheme) |
| 248 | setStore("mode", e.newValue === "system" ? getSystemMode() : (e.newValue as "light" | "dark")) |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | onMount(() => { |
| 253 | makeEventListener(window, "storage", onStorage) |
nothing calls this directly
no test coverage detected