request-animation-frame-polyfill

requestAnimationFrame polyfill library

Usage no npm install needed!

<script type="module">
  import requestAnimationFramePolyfill from 'https://cdn.skypack.dev/request-animation-frame-polyfill';
</script>

README

request-animation-frame-polyfill

npm version

requestAnimationFrame polyfill library for nodejs and old browsers.

Install

$ yarn add request-animation-frame-polyfill

Usage

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

Build:

$ yarn build

Example

$ cd example
$ npx ts-node main.ts

Deploy

$ npm login
$ npm publish