Number of requests to execute in given period
Number of milliseconds in period, set to -1 for concurrency
Error if number of requests exceeds limits
Promise library of your choice
Promise library of your choice
Error if number of requests exceeds limits
Number of milliseconds in period, set to -1 for concurrency
Number of requests to execute in given period
Acquire position in queue
Function to execute
Promise
Example (async/await):
const results = await throttle.acquire(async () => {
// do some async work
return { hello: 'world' };
});
console.log(results); // { hello: 'world' }
Example (Promises):
return throttle.acquire(() => {
// do some work
return { hello: 'world' };
}).then((results) => {
console.log(results); // { hello: 'world' }
});
Clears pending queue without execution
Executes entire pending queue at once
Generated using TypeDoc