MCPcopy Create free account
hub / github.com/Effect-TS/effect / handleUpdate

Function handleUpdate

packages/effect/src/unstable/reactivity/Atom.ts:2245–2254  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2243 return decode ? Option.none() : ""
2244 }
2245 const handleUpdate = () => {
2246 if (searchParamState.updating) return
2247 const searchParams = new URLSearchParams(window.location.search)
2248 const newValue = searchParams.get(name) || ""
2249 if (decode) {
2250 get.setSelf(Exit.getSuccess(decode(newValue)))
2251 } else if (newValue !== Option.getOrUndefined(get.self())) {
2252 get.setSelf(newValue)
2253 }
2254 }
2255 window.addEventListener("popstate", handleUpdate)
2256 window.addEventListener("pushstate", handleUpdate)
2257 get.addFinalizer(() => {

Callers

nothing calls this directly

Calls 4

selfMethod · 0.80
getMethod · 0.65
setSelfMethod · 0.65
decodeFunction · 0.50

Tested by

no test coverage detected