Package Exports
- croq-throttler
 
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (croq-throttler) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Throttler
Throttler to limit parallel request and rate
Constructor
Throttler(nb, rate, send)- nb is the number of parallel request
 - rate is an object which defined the time windows rate limiting, it contain nb and time in ms
 - send is a function which send back a promise, it's what we try to throttle
 
Use
just call throttler.send() and it will return a promise which will be resolve when the request has been sent
Demo
the important file is Throttler.js the rest is here for Demo purpose, you can launch the Demo with
npm run installDemo
npm run demoand connect with your browser on port 9001, after clicking a bit on the send button you should see:

Polling
in my example client.js I use a polling mechanism, so the request given to the throttler don't need to be a simple request. In the demo, the first request is to start the computation, then poll the result every second