1.0.4 • Published 6 years ago

quark-raf v1.0.4

Weekly downloads
31
License
MIT
Repository
github
Last release
6 years ago

build status stability npm version coverage js-standard-style semantic-release

Simple requestAnimationFrame based on Singleton design pattern.

This package is part of quark framework but it can be used independently.

Installation

NPM

npm install quark-raf --save

Usage

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 build

Documentation

To generate the JSDoc :

npm run docs

To generate the documentation and deploy on gh-pages branch :

npm run docs:deploy

Testing

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

License

MIT License © Patrick Heng Fabien Motte

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago