@adobe/helix-shared-process-queue
v3.0.4
Published
Shared modules of the Helix Project - Process Queue
Downloads
18,120
Maintainers
Keywords
Readme
Helix Shared - process queue
Usage
Process tasks concurrently:
const processQueue = require('@adobe/helix-shared-process-queue');
const tasks = [1, 2, 3];
const result = await processQueue(tasks, async (task) => {
console.log(task);
return someValue;
});
Access results during task
const processQueue = require('@adobe/helix-shared-process-queue');
const tasks = [1, 2, 3];
const result = await processQueue(tasks, async (task, queue, results) => {
if (somecondition(results)) {
// returning undefined does not add the return value to results
return;
}
return someValue;
});