(
target: { storage?: string; legacyStorageNames?: string[]; key: string },
platform?: Platform,
)
| 526 | } |
| 527 | |
| 528 | export function removePersisted( |
| 529 | target: { storage?: string; legacyStorageNames?: string[]; key: string }, |
| 530 | platform?: Platform, |
| 531 | ) { |
| 532 | const isDesktop = platform?.platform === "desktop" && !!platform.storage |
| 533 | |
| 534 | if (isDesktop) { |
| 535 | void platform.storage?.(target.storage)?.removeItem(target.key) |
| 536 | for (const storage of target.legacyStorageNames ?? []) { |
| 537 | void platform.storage?.(storage)?.removeItem(target.key) |
| 538 | } |
| 539 | return |
| 540 | } |
| 541 | |
| 542 | if (!target.storage) { |
| 543 | localStorageDirect().removeItem(target.key) |
| 544 | return |
| 545 | } |
| 546 | |
| 547 | localStorageWithPrefix(target.storage).removeItem(target.key) |
| 548 | for (const storage of target.legacyStorageNames ?? []) { |
| 549 | localStorageWithPrefix(storage).removeItem(target.key) |
| 550 | } |
| 551 | } |
| 552 | |
| 553 | export function persisted<T>( |
| 554 | target: string | PersistTarget, |
no test coverage detected