MCPcopy Create free account
hub / github.com/bytebase/bytebase / waitForBroadcast

Function waitForBroadcast

frontend/src/connect/refreshToken.ts:59–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

57}
58
59function waitForBroadcast(): Promise<boolean> {
60 return new Promise((resolve) => {
61 const channel = new BroadcastChannel(CHANNEL_NAME);
62
63 const cleanup = (received: boolean) => {
64 channel.close();
65 resolve(received);
66 };
67
68 const timeout = setTimeout(() => cleanup(false), WAIT_TIMEOUT_MS);
69
70 channel.onmessage = () => {
71 clearTimeout(timeout);
72 cleanup(true);
73 };
74 });
75}

Callers 1

doRefreshFunction · 0.85

Calls 1

cleanupFunction · 0.70

Tested by

no test coverage detected