(durationMs = 0)
| 27 | } |
| 28 | |
| 29 | const scheduleSync = (durationMs = 0) => { |
| 30 | if (frameId) { |
| 31 | cancelAnimationFrame(frameId) |
| 32 | } |
| 33 | |
| 34 | const startedAt = performance.now() |
| 35 | const tick = () => { |
| 36 | syncTitleBarColor() |
| 37 | if (performance.now() - startedAt < durationMs) { |
| 38 | frameId = requestAnimationFrame(tick) |
| 39 | } else { |
| 40 | frameId = 0 |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | nextTick(() => { |
| 45 | frameId = requestAnimationFrame(tick) |
| 46 | }) |
| 47 | } |
| 48 | |
| 49 | const handleResize = () => scheduleSync() |
| 50 |
no test coverage detected