nk-request-timeout
v1.0.1
Published
Like setTimeout() but using requestAnimationFrame()
Downloads
130
Maintainers
Readme
request-timeout
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.