Like setInterval()
but using requestAnimationFrame().
You can also find requestTimeout
component here.
With npm do:
$ npm install request-interval --save
Install with component(1):
$ component install nk-components/request-interval
var requestInterval = require('request-interval');
var id = requestInterval(300, function() {
// do something
});
// [...]
// stop
requestInterval.clear(id);
If you need to support IE9, add a polyfill for requestAnimationFrame()
and cancelAnimationFrame()
MIT
Inspired by Joe Lambert's Gist.