( key: Key, )
| 248 | * setFromCurrentValue((currentValue) => { // return the new value }); |
| 249 | */ |
| 250 | export const getSetFromLocalStorageValue = <Key extends keyof LocalStorage>( |
| 251 | key: Key, |
| 252 | ): ((replaceFunction: ReplaceFromLocalStorageValue<Key>) => Promise<void>) => { |
| 253 | return async (replaceFunction) => { |
| 254 | const currentValue = await getFromLocalStorage(key); |
| 255 | const newValue = replaceFunction(currentValue); |
| 256 | await setInLocalStorage(key, newValue); |
| 257 | }; |
| 258 | }; |
| 259 | |
| 260 | export const clearLocalStorage = async () => { |
| 261 | await browser.storage.local.clear(); |
no test coverage detected