Skip to content

Latest commit

 

History

History
46 lines (30 loc) · 1.04 KB

README.md

File metadata and controls

46 lines (30 loc) · 1.04 KB

request-timeout Build Status

Like setTimeout() but using requestAnimationFrame().

setTimeout doesn’t take into account what else is happening in the browser.
Source

You can also find requestInterval component here.

Installation

With npm do:

$ npm install nk-request-timeout --save

Install with component(1):

$ component install nk-components/request-timeout

API

var requestTimeout = require('request-timeout');

requestTimeout(300, function() {
  // do something
});

var id = requestTimeout(300, function() {
  console.log('should not be executed');
});

setTimeout(function() {
  requestTimeout.clear(id);
}, 100);

License

MIT

Inspired by Joe Lambert's Gist.