0.0.2 • Published 10 years ago

gasp v0.0.2

Weekly downloads
93
License
-
Repository
-
Last release
10 years ago

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 ...
})
0.0.2

10 years ago

0.0.1

10 years ago