1.0.4 • Published 8 years ago
quark-raf v1.0.4
Simple requestAnimationFrame based on Singleton design pattern.
This package is part of quark framework but it can be used independently.
Installation
npm install quark-raf --saveUsage
Add a listener
import Raf from 'quark-raf'
const callback = () => { }
Raf.add(callback)Add a listener with options
import Raf from 'quark-raf'
const callback = () => { }
const fps = 30
const delay = 1000 // in milliseconds
Raf.add(callback, fps, delay)Add once a listener
import Raf from 'quark-raf'
const callback = () => { }
Raf.addOnce(callback)Remove a listener
import Raf from 'quark-raf'
const callback = () => { }
Raf.add(callback)
Raf.remove(callback)API
See https://fm-ph.github.io/quark-raf/
Build
To build the sources with babel in ./lib directory :
npm run buildDocumentation
To generate the JSDoc :
npm run docsTo generate the documentation and deploy on gh-pages branch :
npm run docs:deployTesting
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 installThen, run the tests :
npm testTo watch (test-driven development) :
npm run test:watchFor coverage :
npm run test:coverageLicense
MIT License © Patrick Heng Fabien Motte
