* Start background polling. Safe to call multiple times — creates at most * one timer. Performs an immediate refresh before starting the interval.
(interval?: number)
| 268 | * one timer. Performs an immediate refresh before starting the interval. |
| 269 | */ |
| 270 | function startPolling(interval?: number): void { |
| 271 | if (pollingTimer !== null) return; // already polling |
| 272 | if (interval !== undefined) { |
| 273 | pollInterval.value = interval; |
| 274 | } |
| 275 | void refreshAll(); |
| 276 | pollingTimer = window.setInterval(() => { |
| 277 | void refreshAll(); |
| 278 | // Sync the playback cursor to live time when not scrubbing. |
| 279 | tickPlaybackSync(); |
| 280 | }, pollInterval.value); |
| 281 | } |
| 282 | |
| 283 | /** Stop background polling and clear the timer. */ |
| 284 | function stopPolling(): void { |
nothing calls this directly
no test coverage detected