MCPcopy Create free account
hub / github.com/hashintel/hash / getSetFromLocalStorageValue

Function getSetFromLocalStorageValue

apps/plugin-browser/src/shared/storage.ts:250–258  ·  view source on GitHub ↗
(
  key: Key,
)

Source from the content-addressed store, hash-verified

248 * setFromCurrentValue((currentValue) => { // return the new value });
249 */
250export 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
260export const clearLocalStorage = async () => {
261 await browser.storage.local.clear();

Callers 1

infer-entities.tsFile · 0.90

Calls 2

getFromLocalStorageFunction · 0.85
setInLocalStorageFunction · 0.85

Tested by

no test coverage detected