one
Version:
One is a new React Framework that makes Vite serve both native and web.
25 lines (24 loc) • 536 B
JavaScript
function pLimit(concurrency) {
var queue = [];
var active = 0;
var 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