@harexs/limit
v1.0.1
Published
Promise-Async functions with limited concurrency
Downloads
4
Maintainers
Readme
harexs-limit
Promise-Async functions with limited concurrency
Install
$ npm install @harexs/limit
Usage
import harexsLimit from "harexs-limit";
let limit = harexsLimit(3);
function sleep(sec) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, sec * 1000);
});
}
limit(sleep, 1);
limit(sleep, 1.1);
limit(sleep, 1.2);
limit(sleep, 3);
limit(sleep, 1.3);