Simple requestAnimationFrame based on Singleton design pattern.
This package is part of quark
framework but it can be used independently.
npm install quark-raf --save
import Raf from 'quark-raf'
const callback = () => { }
Raf.add(callback)
import Raf from 'quark-raf'
const callback = () => { }
const fps = 30
const delay = 1000 // in milliseconds
Raf.add(callback, fps, delay)
import Raf from 'quark-raf'
const callback = () => { }
Raf.addOnce(callback)
import Raf from 'quark-raf'
const callback = () => { }
Raf.add(callback)
Raf.remove(callback)
See https://fm-ph.github.io/quark-raf/
To build the sources with babel
in ./lib
directory :
npm run build
To generate the JSDoc
:
npm run docs
To generate the documentation and deploy on gh-pages
branch :
npm run docs:deploy
To run the tests, first clone the repository and install its dependencies :
git clone https://github.com/fm_ph/quark-raf.git
cd quark-raf
npm install
Then, run the tests :
npm test
To watch (test-driven development) :
npm run test:watch
For coverage :
npm run test:coverage
MIT License © Patrick Heng Fabien Motte