MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / onStorage

Function onStorage

packages/react/src/api/oauth-popup.ts:117–133  ·  view source on GitHub ↗
(event: StorageEvent)

Source from the content-addressed store, hash-verified

115 // auto-close (unlike a raced BroadcastChannel). The callback writes the result
116 // under `channelName`; we read it, clean up, and settle.
117 const onStorage = (event: StorageEvent) => {
118 if (event.key !== input.channelName || event.newValue === null) return;
119 // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: JSON.parse of a foreign storage value can throw
120 try {
121 // oxlint-disable-next-line executor/no-json-parse -- boundary: browser-only helper, no Effect runtime; parsing a same-origin localStorage signal
122 const data: unknown = JSON.parse(event.newValue);
123 // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: localStorage can throw (private mode / disabled)
124 try {
125 window.localStorage.removeItem(input.channelName);
126 } catch {
127 // best-effort cleanup
128 }
129 handleResult(data);
130 } catch {
131 // Malformed value — ignore; another channel may still deliver.
132 }
133 };
134
135 const stopPolling = () => {
136 if (pollHandle !== null) {

Callers

nothing calls this directly

Calls 1

handleResultFunction · 0.70

Tested by

no test coverage detected