* Check if localStorage is available * @returns True if localStorage is available and accessible
()
| 85 | * @returns True if localStorage is available and accessible |
| 86 | */ |
| 87 | static isAvailable(): boolean { |
| 88 | if (typeof window === 'undefined') { |
| 89 | return false |
| 90 | } |
| 91 | |
| 92 | try { |
| 93 | const testKey = '__test_localStorage_availability__' |
| 94 | window.localStorage.setItem(testKey, 'test') |
| 95 | window.localStorage.removeItem(testKey) |
| 96 | return true |
| 97 | } catch { |
| 98 | return false |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | export const STORAGE_KEYS = { |
nothing calls this directly
no test coverage detected