First upload version 0.0.1
This commit is contained in:
1
node_modules/ipull/dist/download/download-engine/engine/utils/concurrency.d.ts
generated
vendored
Normal file
1
node_modules/ipull/dist/download/download-engine/engine/utils/concurrency.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function concurrency<Value>(array: Value[], concurrencyCount: number, callback: (value: Value) => Promise<void>): Promise<void>;
|
||||
22
node_modules/ipull/dist/download/download-engine/engine/utils/concurrency.js
generated
vendored
Normal file
22
node_modules/ipull/dist/download/download-engine/engine/utils/concurrency.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
export function concurrency(array, concurrencyCount, callback) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let index = 0;
|
||||
let activeCount = 0;
|
||||
function next() {
|
||||
if (index === array.length && activeCount === 0) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
while (activeCount < concurrencyCount && index < array.length) {
|
||||
activeCount++;
|
||||
callback(array[index++])
|
||||
.then(() => {
|
||||
activeCount--;
|
||||
next();
|
||||
}, reject);
|
||||
}
|
||||
}
|
||||
next();
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=concurrency.js.map
|
||||
1
node_modules/ipull/dist/download/download-engine/engine/utils/concurrency.js.map
generated
vendored
Normal file
1
node_modules/ipull/dist/download/download-engine/engine/utils/concurrency.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"concurrency.js","sourceRoot":"","sources":["../../../../../src/download/download-engine/engine/utils/concurrency.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAQ,KAAc,EAAE,gBAAwB,EAAE,QAAyC;IAClH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACnC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,WAAW,GAAG,CAAC,CAAC;QAEpB,SAAS,IAAI;YACT,IAAI,KAAK,KAAK,KAAK,CAAC,MAAM,IAAI,WAAW,KAAK,CAAC,EAAE,CAAC;gBAC9C,OAAO,EAAE,CAAC;gBACV,OAAO;YACX,CAAC;YAED,OAAO,WAAW,GAAG,gBAAgB,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;gBAC5D,WAAW,EAAE,CAAC;gBACd,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;qBACnB,IAAI,CAAC,GAAG,EAAE;oBACP,WAAW,EAAE,CAAC;oBACd,IAAI,EAAE,CAAC;gBACX,CAAC,EAAE,MAAM,CAAC,CAAC;YACnB,CAAC;QACL,CAAC;QAED,IAAI,EAAE,CAAC;IACX,CAAC,CAAC,CAAC;AACP,CAAC"}
|
||||
Reference in New Issue
Block a user