2 * Task synchronous function that can be executed.
4 * @param data - Data sent to the worker.
6 * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
7 * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
9 export type TaskSyncFunction
<Data
= unknown
, Response
= unknown
> = (
14 * Task asynchronous function that can be executed.
15 * This function must return a promise.
17 * @param data - Data sent to the worker.
19 * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
20 * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
22 export type TaskAsyncFunction
<Data
= unknown
, Response
= unknown
> = (
24 ) => Promise
<Response
>
27 * Task function that can be executed.
28 * This function can be synchronous or asynchronous.
30 * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
31 * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
33 export type TaskFunction
<Data
= unknown
, Response
= unknown
> =
34 | TaskSyncFunction
<Data
, Response
>
35 | TaskAsyncFunction
<Data
, Response
>
38 * Tasks functions that can be executed.
39 * This object can contain synchronous or asynchronous functions.
40 * The key is the name of the function.
41 * The value is the function itself.
43 * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
44 * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
46 export type TaskFunctions
<Data
= unknown
, Response
= unknown
> = Record
<
48 TaskFunction
<Data
, Response
>
52 * Task function operation result.
54 export interface TaskFunctionOperationResult
{