From 09b75fef0162fa1a333d3c61c6da735b771ed801 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 25 Oct 2023 22:04:11 +0200 Subject: [PATCH] docs: enchance code comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/pools/worker.ts | 8 ++++++++ src/worker/task-functions.ts | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/pools/worker.ts b/src/pools/worker.ts index 03cecce8..b3e02f3c 100644 --- a/src/pools/worker.ts +++ b/src/pools/worker.ts @@ -4,11 +4,15 @@ import type { Task } from '../utility-types' /** * Callback invoked when the worker has started successfully. + * + * @typeParam Worker - Type of worker. */ export type OnlineHandler = (this: Worker) => void /** * Callback invoked if the worker has received a message. + * + * @typeParam Worker - Type of worker. */ export type MessageHandler = ( this: Worker, @@ -17,6 +21,8 @@ export type MessageHandler = ( /** * Callback invoked if the worker raised an error. + * + * @typeParam Worker - Type of worker. */ export type ErrorHandler = ( this: Worker, @@ -25,6 +31,8 @@ export type ErrorHandler = ( /** * Callback invoked when the worker exits successfully. + * + * @typeParam Worker - Type of worker. */ export type ExitHandler = ( this: Worker, diff --git a/src/worker/task-functions.ts b/src/worker/task-functions.ts index ef9e1f0a..b912f05c 100644 --- a/src/worker/task-functions.ts +++ b/src/worker/task-functions.ts @@ -1,6 +1,8 @@ /** * Task synchronous function that can be executed. * + * @param data - Data sent to the worker. + * * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data. * @typeParam Response - Type of execution response. This can only be structured-cloneable data. */ @@ -12,6 +14,8 @@ export type TaskSyncFunction = ( * Task asynchronous function that can be executed. * This function must return a promise. * + * @param data - Data sent to the worker. + * * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data. * @typeParam Response - Type of execution response. This can only be structured-cloneable data. */ -- 2.34.1