(key, fallback = null)
| 5 | // on macOS — outside WebKit's reach, so WebView resets can never destroy user data. |
| 6 | |
| 7 | export async function storeGet(key, fallback = null) { |
| 8 | if (window.__TAURI__?.core?.invoke) { |
| 9 | try { |
| 10 | const val = await window.__TAURI__.core.invoke("store_get", { key }); |
| 11 | return val ?? fallback; |
| 12 | } catch (e) { console.warn("[store] get failed for", key, e); return fallback; } |
| 13 | } |
| 14 | try { |
| 15 | const raw = localStorage.getItem(key); |
| 16 | return raw !== null ? JSON.parse(raw) : fallback; |
| 17 | } catch (e) { console.warn("[store] localStorage get failed for", key, e); return fallback; } |
| 18 | } |
| 19 | |
| 20 | export async function storeSet(key, value) { |
| 21 | if (window.__TAURI__?.core?.invoke) { |
no outgoing calls
no test coverage detected