JSPM

  • Created
  • Published
  • Downloads 1016
  • Score
    100M100P100Q109502F
  • License MIT

requestAnimationFrame polyfill library

Package Exports

  • request-animation-frame-polyfill

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (request-animation-frame-polyfill) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

request-animation-frame-polyfill

request-animation-frame-polyfill supports the polyfill of requestAnimationFrame in nodejs, old browser environments.

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 & Test

Build:

$ yarn install
$ npx babel src/index.ts > lib/request-animation-frame-polyfill.js

Test:

$ yarn run test

## For commonJS
$ yarn run build && node ./src/index.node.test.js

Deploy

$ npm login
$ npm publish