MCPcopy Create free account
hub / github.com/LevelUpWeb3/app / saveState

Function saveState

src/utils/localStorage.ts:17–34  ·  view source on GitHub ↗
(key: string = "state", state: any)

Source from the content-addressed store, hash-verified

15};
16
17export const saveState = (key: string = "state", state: any) => {
18 try {
19 const seen: any = [];
20 const serializedState = JSON.stringify(state, (key, val) => {
21 if (val !== null && typeof val === "object") {
22 if (seen.indexOf(val) >= 0) {
23 return;
24 }
25 seen.push(val);
26 }
27 return val;
28 });
29 setItem(key, serializedState);
30 } catch (err) {
31 // Ignore write errors.
32 console.error(err);
33 }
34};
35
36export function putState(
37 key: string = "state",

Callers 1

putStateFunction · 0.85

Calls 1

setItemFunction · 0.85

Tested by

no test coverage detected