Skip to content

aluc-io/request-animation-frame-polyfill

Repository files navigation

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