Skip to content

nk-components/request-interval

Repository files navigation

request-interval Build Status

Like setInterval() but using requestAnimationFrame().
You can also find requestTimeout component here.

Installation

With npm do:

$ npm install request-interval --save

Install with component(1):

$ component install nk-components/request-interval

API

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()

License

MIT

Inspired by Joe Lambert's Gist.

About

Like setInterval() but using requestAnimationFrame()

Resources

License

Stars

Watchers

Forks

Packages

No packages published