()
| 123 | } |
| 124 | |
| 125 | function scheduleSync() { |
| 126 | if (!active || idleHandle !== null) { |
| 127 | return; |
| 128 | } |
| 129 | const run = () => { |
| 130 | idleHandle = null; |
| 131 | void syncCoreCache().catch(() => {}); |
| 132 | }; |
| 133 | if ("requestIdleCallback" in window) { |
| 134 | idleHandle = window.requestIdleCallback(run, {timeout: 5000}); |
| 135 | } else { |
| 136 | idleHandle = window.setTimeout(run, 1000); |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | export function startCoreCacheSync() { |
| 141 | if (active) { |
no outgoing calls
no test coverage detected