()
| 17 | * Load configuration from localStorage |
| 18 | */ |
| 19 | export function loadConfig(): Required<A11yPluginOptions> { |
| 20 | if (typeof localStorage === 'undefined') { |
| 21 | return DEFAULT_CONFIG |
| 22 | } |
| 23 | |
| 24 | try { |
| 25 | const stored = localStorage.getItem(STORAGE_KEY) |
| 26 | if (stored) { |
| 27 | const parsed = JSON.parse(stored) as Partial<A11yPluginOptions> |
| 28 | return { ...DEFAULT_CONFIG, ...parsed } |
| 29 | } |
| 30 | } catch (error) { |
| 31 | console.warn( |
| 32 | '[A11y Config] Failed to load config from localStorage:', |
| 33 | error, |
| 34 | ) |
| 35 | } |
| 36 | |
| 37 | return DEFAULT_CONFIG |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Save configuration to localStorage |
no outgoing calls
no test coverage detected