A Scheduler decouples the loop from requestAnimationFrame/setTimeout, so tests can drive it with a fake clock without ever touching real time.
Scheduler
requestAnimationFrame
setTimeout
Default schedulers exist for the browser (rAF) and Node (setImmediate).
Readonly
Current high-resolution time in milliseconds.
Schedule callback for the next frame. The timestamp arg matches now() at the time the callback fires.
callback
timestamp
now()
Returns a cancel function.
A
Schedulerdecouples the loop fromrequestAnimationFrame/setTimeout, so tests can drive it with a fake clock without ever touching real time.Default schedulers exist for the browser (rAF) and Node (setImmediate).