JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1630
  • Score
    100M100P100Q113818F
  • License MIT

Only call RAF when needed

Package Exports

  • nanoraf

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 (nanoraf) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

nanoraf stability

npm version build status test coverage downloads js-standard-style

Only call RAF when needed.

Usage

const nanoraf = require('nanoraf')

const frame = nanoraf(function render (state) {
  console.log(state.now)
})

frame({ now: date.now() })
frame({ now: date.now() })
frame({ now: date.now() })
frame({ now: date.now() })

API

frame = nanoraf(render)

Wrap a render function that is called on every raf tick. If no new data is available, it will not tick. Passes the last version of the data on every tick.

frame(state)

Pass new data into the render function, to be called on a new tick.

Installation

$ npm install nanoraf

License

MIT