forked from olcxjas-softworks/LarpixClient
update electron to v43
This commit is contained in:
parent
68ac0beedf
commit
fb6c8b6ee9
5385 changed files with 513060 additions and 123058 deletions
24
electron/node_modules/tiny-async-pool/lib/es6.js
generated
vendored
Normal file
24
electron/node_modules/tiny-async-pool/lib/es6.js
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
function asyncPool(poolLimit, iterable, iteratorFn) {
|
||||
let i = 0;
|
||||
const ret = [];
|
||||
const executing = new Set();
|
||||
const enqueue = function() {
|
||||
if (i === iterable.length) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
const item = iterable[i++];
|
||||
const p = Promise.resolve().then(() => iteratorFn(item, iterable));
|
||||
ret.push(p);
|
||||
executing.add(p);
|
||||
const clean = () => executing.delete(p);
|
||||
p.then(clean).catch(clean);
|
||||
let r = Promise.resolve();
|
||||
if (executing.size >= poolLimit) {
|
||||
r = Promise.race(executing);
|
||||
}
|
||||
return r.then(() => enqueue());
|
||||
};
|
||||
return enqueue().then(() => Promise.all(ret));
|
||||
}
|
||||
|
||||
module.exports = asyncPool;
|
||||
Loading…
Add table
Add a link
Reference in a new issue