()
| 25 | } |
| 26 | |
| 27 | async function doRefresh(): Promise<void> { |
| 28 | if (await tryAcquireAndRefresh()) { |
| 29 | return; |
| 30 | } |
| 31 | |
| 32 | // Another tab is refreshing - wait for broadcast |
| 33 | const receivedBroadcast = await waitForBroadcast(); |
| 34 | |
| 35 | // Only retry if timed out (missed broadcast or other tab failed) |
| 36 | if (!receivedBroadcast) { |
| 37 | await tryAcquireAndRefresh(); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | async function tryAcquireAndRefresh(): Promise<boolean> { |
| 42 | return navigator.locks.request( |
no test coverage detected