Type alias GroupTaskConfigI<T, R>

GroupTaskConfigI<T, R>: GroupTaskConfigOldI<T, R> | GroupTaskConfigNewI<T, R>

The interface of the configuration options for a group task.

Type Parameters

  • T extends unknown[]

    The type of the task worker parameters.

  • R

    The type of the task worker result.

Example

Use to define a group task configuration.

const dataGetterConfig: GroupTaskConfigI<[url: string], Promise<JSON>> = {
mode: "parallel", // or "series"
subTasks: [txtDataGetterTask, audioDataGetterTask, booksGetterGroupTask],
};

Example

Other valid configurations.

// with optional worker function
const dataGetterConfig: GroupTaskConfigI<[url: string], Promise<JSON>> = {
mode: "parallel", // or "series"
subTasks: [txtDataGetterTask, audioDataGetterTask, booksGetterGroupTask],
worker: async (url) => {
const response = await fetch(url);
const movies = await response.json();
return movies;
};
};

// with optional worker parameters
const dataGetterConfig: GroupTaskConfigI<[url: string], Promise<JSON>> = {
mode: "parallel", // or "series"
subTasks: [txtDataGetterTask, audioDataGetterTask, booksGetterGroupTask],
workerParams: ["example.com"]
};

// with both optional worker function and worker parameters
const dataGetterConfig: GroupTaskConfigI<[url: string], Promise<JSON>> = {
mode: "parallel", // or "series"
subTasks: [txtDataGetterTask, audioDataGetterTask, booksGetterGroupTask],
worker: async (url) => {
const response = await fetch(url);
const movies = await response.json();
return movies;
};
workerParams: ["example.com"]
};

Generated using TypeDoc