2 * Task synchronous function that can be executed.
4 * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
5 * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
7 export type TaskSyncFunction
<Data
= unknown
, Response
= unknown
> = (
12 * Task asynchronous function that can be executed.
13 * This function must return a promise.
15 * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
16 * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
18 export type TaskAsyncFunction
<Data
= unknown
, Response
= unknown
> = (
20 ) => Promise
<Response
>
23 * Task function that can be executed.
24 * This function can be synchronous or asynchronous.
26 * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
27 * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
29 export type TaskFunction
<Data
= unknown
, Response
= unknown
> =
30 | TaskSyncFunction
<Data
, Response
>
31 | TaskAsyncFunction
<Data
, Response
>
34 * Tasks functions that can be executed.
35 * This object can contain synchronous or asynchronous functions.
36 * The key is the name of the function.
37 * The value is the function itself.
39 * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
40 * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
42 export type TaskFunctions
<Data
= unknown
, Response
= unknown
> = Record
<
44 TaskFunction
<Data
, Response
>