preemptive-animation-frame
Library provides same API as window.requestAnimationFrame but in contrast it is preemptive. It is possible to drop a frame if window.requestAnimationFrame is called (after you've done handling of the current frame) too late. This library helps you avoid such frames drops by wrapping native API and scheduling request ahead of time.
It is especially useful when working with high level abstractions that require you to schedule requests at the end update step.
Install
npm install preemptive-animation-frame
API
const PAF = // scheduleconst requestID = PAF // cancelPAF
Unstable API
You can force animation frame to fire at your demand with forceAnimationFrame
PAF
Library internally uses performance.now()
polyfill, if you use it in conjunction with this library consider using exported now
function to have consistent starting point for produced timestamps.
PAF