The type of the task worker parameters.
The type of the task worker result.
The type of the task worker parameters.
The type of the task worker result.
The configuration options for the task.
{}
Gets the task worker result.
The task worker result.
Internal
Sets the task worker result.
The task worker result.
Gets the task worker function.
The task worker function.
Sets the task worker function.
The task worker function.
Gets the task worker parameters.
The task worker parameters.
Sets the task worker parameters.
The task worker parameters.
Executes the task.
The fallback task configuration.
The task worker result.
A task must have a worker function and worker parameters defined at the time of execution.
If any of them is undefined, then it should be set or provided via the fallback configuration to use for the execution, else it will throw an error.
Fallback configuration does not set the worker function or worker parameters but only provides the temporary values to fallback on.
If even fallback values are undefined, then it throws an error.
If no configuration and no fallback configuration is set.
If no worker function is set and no fallback worker function is provided either.
If no worker parameters are set and no fallback worker parameters are provided either.
Without fallback configuration.
task.execute();
// will run successfully if task.worker and task.workerParams are not undefined
With a fallback worker function.
task.execute({ worker: (a, b) => a - b });
// fallback worker function will be used only if task.worker is undefined
// will run successfully if task.workerParams is not undefined
With fallback worker parameters.
task.execute({ workerParams: [3, 4] });
// fallback worker parameters will be used only if task.workerParams is undefined
// will run successfully if task.worker is not undefined
With both fallback worker and worker parameters.
task.execute({ worker: (a, b) => a - b, workerParams: [3, 4] });
// fallback worker function will be used only if task.worker is undefined
// fallback worker parameters will be used only if task.workerParams is undefined
// will run successfully even if task.worker and task.workerParams are undefined
Generated using TypeDoc
Task class represents an individual task which in very simplest form calls its defined worker function with its defined worker parameters on execution.
Remarks
It can optionally have a worker function and worker parameters in its configuration. It has an execute method which is used to run the task and store its result.
If any of worker function or worker parameters is undefined then it uses the fallback configuration for the execution.
It can be a sub task of a group task.
Example
Task with no configuration.
Example
Task with worker function only.
Example
Task with worker parameters only.
Example
Task with both worker function and woker parameters.