(fpsCap: number)
| 14 | } |
| 15 | |
| 16 | export function computeTickTiming(fpsCap: number): TickTiming { |
| 17 | const safeFpsCap = sanitizeFpsCap(fpsCap); |
| 18 | const intervalFromFps = Math.max(MIN_EVENT_POLL_INTERVAL_MS, Math.floor(1000 / safeFpsCap)); |
| 19 | const tickIntervalMs = Math.min(MAX_EVENT_POLL_INTERVAL_MS, intervalFromFps); |
| 20 | const maxIdleDelayMs = Math.max( |
| 21 | MIN_IDLE_BACKOFF_MS, |
| 22 | Math.min(MAX_IDLE_BACKOFF_MS, tickIntervalMs * 8), |
| 23 | ); |
| 24 | return Object.freeze({ tickIntervalMs, maxIdleDelayMs }); |
| 25 | } |
| 26 | |
| 27 | export function computeNextIdleDelay( |
| 28 | currentIdleDelayMs: number, |
no test coverage detected