one
Version:
One is a new React Framework that makes Vite serve both native and web.
23 lines (22 loc) • 528 B
JavaScript
function pLimit(concurrency) {
var queue = [],
active = 0,
next = function () {
if (active < concurrency && queue.length > 0) {
active++;
var fn = queue.shift();
fn();
}
};
return function (fn) {
return new Promise(function (resolve, reject) {
queue.push(function () {
fn().then(resolve).catch(reject).finally(function () {
active--, next();
});
}), next();
});
};
}
export { pLimit };
//# sourceMappingURL=pLimit.native.js.map