(key: string, options: StorageOptions<T> = {})
| 116 | const hashListeners: ListenKey[] = []; |
| 117 | const storageListeners: ListenKey[] = []; |
| 118 | function get(key: string, options: StorageOptions<T> = {}): T { |
| 119 | const {defaultValue, useLocalStorage = false} = options; |
| 120 | const value = useLocalStorage |
| 121 | ? window.localStorage.getItem(key) |
| 122 | : componentToDict(readComponent())[key]; |
| 123 | return value == undefined ? _.cloneDeep(defaultValue)! : fromString(value)!; |
| 124 | } |
| 125 | function set(key: string, value: T, options: SetterOptions<T> = {}): void { |
| 126 | const { |
| 127 | defaultValue, |
no test coverage detected