X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futility-types.ts;h=ea90afd688d8622ee2128366c2b3e20d5302977a;hb=2092c35fc1873fb746244f15af3478e246bb4b3b;hp=81a57698f5fa6a7dc5e631cbdec844ee68c44c2c;hpb=48ef910747c7eafb18ebfff83d8eb24e5f5be26c;p=poolifier.git diff --git a/src/utility-types.ts b/src/utility-types.ts index 81a57698..ea90afd6 100644 --- a/src/utility-types.ts +++ b/src/utility-types.ts @@ -40,14 +40,31 @@ export interface MessageValue< } /** - * Worker function that can be executed types. + * Worker synchronous function that can be executed. + * + * @typeParam Data - Type of data sent to the worker. This can only be serializable data. + * @typeParam Response - Type of execution response. This can only be serializable data. */ export type WorkerSyncFunction = ( data?: Data ) => Response +/** + * Worker asynchronous function that can be executed. + * This function must return a promise. + * + * @typeParam Data - Type of data sent to the worker. This can only be serializable data. + * @typeParam Response - Type of execution response. This can only be serializable data. + */ export type WorkerAsyncFunction = ( data?: Data ) => Promise +/** + * Worker function that can be executed. + * This function can be synchronous or asynchronous. + * + * @typeParam Data - Type of data sent to the worker. This can only be serializable data. + * @typeParam Response - Type of execution response. This can only be serializable data. + */ export type WorkerFunction = | WorkerSyncFunction | WorkerAsyncFunction