gasp
v0.0.2
Published
Promise based throttling
Downloads
1,477
Readme
Promise based throttling
Usage:
var Q = require("q");
var gasp = require("gasp");
//throttle the XHR to a call every 100ms
var gaspingXHR = gasp(function (url) {
//make request (imagined api)
return request.makeRequest(url)
}, 100)
var newUpdate;
//then make the calls
setInterval(function() {
newUpdate = gaspingXHR("http://foo.com");
}, 1);
newUpdate.then(function (response) {
// do something ...
})