requestAnimationFrame
polyfill library for nodejs and old browsers.
$ yarn add request-animation-frame-polyfill
import { requestAnimationFrame, cancelAnimationFrame } from 'request-animation-frame-polyfill'
let id: number
const hello = (time: number) => {
console.log('hello:' + time)
id = requestAnimationFrame(hello)
}
id = requestAnimationFrame(hello)
setTimeout( () => cancelAnimationFrame(id), 100)
Build:
$ yarn install
$ npx babel src/index.ts > lib/request-animation-frame-polyfill.js
Test:
$ yarn test
$ npm login
$ npm publish