2 * Task synchronous function that can be executed.
4 * @param data - Data sent to the worker.
5 * @returns Execution response.
7 * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
8 * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
10 export type TaskSyncFunction
<Data
= unknown
, Response
= unknown
> = (
15 * Task asynchronous function that can be executed.
16 * This function must return a promise.
18 * @param data - Data sent to the worker.
19 * @returns Execution response promise.
21 * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
22 * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
24 export type TaskAsyncFunction
<Data
= unknown
, Response
= unknown
> = (
26 ) => Promise
<Response
>
29 * Task function that can be executed.
30 * This function can be synchronous or asynchronous.
32 * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
33 * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
35 export type TaskFunction
<Data
= unknown
, Response
= unknown
> =
36 | TaskSyncFunction
<Data
, Response
>
37 | TaskAsyncFunction
<Data
, Response
>
40 * Tasks functions that can be executed.
41 * This object can contain synchronous or asynchronous functions.
42 * The key is the name of the function.
43 * The value is the function itself.
45 * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
46 * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
48 export type TaskFunctions
<Data
= unknown
, Response
= unknown
> = Record
<
50 TaskFunction
<Data
, Response
>
54 * Task function operation result.
56 export interface TaskFunctionOperationResult
{