MCPcopy Create free account
hub / github.com/anomalyco/opencode / setStorage

Function setStorage

packages/app/src/entry.tsx:41–52  ·  view source on GitHub ↗
(key: string, value: string | null)

Source from the content-addressed store, hash-verified

39}
40
41const setStorage = (key: string, value: string | null) => {
42 if (typeof localStorage === "undefined") return
43 try {
44 if (value !== null) {
45 localStorage.setItem(key, value)
46 return
47 }
48 localStorage.removeItem(key)
49 } catch {
50 return
51 }
52}
53
54const readDefaultServerUrl = () => getStorage(DEFAULT_SERVER_URL_KEY)
55const writeDefaultServerUrl = (url: string | null) => setStorage(DEFAULT_SERVER_URL_KEY, url)

Callers 1

writeDefaultServerUrlFunction · 0.85

Calls 2

setItemMethod · 0.80
removeItemMethod · 0.80

Tested by

no test coverage detected