| 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(() => { |