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 build
$ cd example
$ npx ts-node main.ts
$ npm login
$ npm publish