Interface TaskConfigI<T, R>

The interface of the configuration options for a task.

Example

Use to define a task configuration.

const moviesGetterConfig: TaskConfigI<[url: string], Promise<JSON>> = {
worker: moviesGetter,
workerParams: moviesGetterParams,
};

Example

Use to define a template for similar task configurations.

type TwoNumbersConfigTemplate = TaskConfigI<[number, number], number>;
const adderConfig: TwoNumbersConfigTemplate = {
worker: adder,
workerParams: adderParams,
};
const multiplierConfig: TwoNumbersConfigTemplate = {
worker: multiplier,
workerParams: multiplierParams,
};

Example

Other valid configurations.

const emptyConfig: TaskConfigI<unknown[], unknown> = {};

const onlyWorkerConfig: TaskConfigI<[number, number], number> = {
worker: adder,
};

const onlyWorkerParamsConfig: TaskConfigI<[number, number], unknown> = {
workerParams: [1, 2],
};

Type Parameters

  • T extends unknown[]

    The type of the task worker parameters.

  • R

    The type of the task worker result.

Hierarchy

Properties

Properties

worker?: TaskWorkerT<T, R>

The task worker function that if defined, will be run when the task is executed.

workerParams?: TaskWorkerParamsT<T>

The task worker parameters that if defined, will be passed to the task work function as its arguments for task execution.

Generated using TypeDoc