This method is available on both pool implementations and returns a promise with the task function execution response.
+### `pool.mapExecute(data, name, transferList)`
+
+`data` Iterable objects that you want to pass to your worker task function implementation.
+`name` (optional) A string with the task function name that you want to execute on the worker. Default: `'default'`
+`transferList` (optional) An array of transferable objects that you want to transfer to your [`ThreadWorker`](#class-yourworker-extends-threadworkerclusterworker) worker implementation.
+
+This method is available on both pool implementations and returns a promise with the task function execution responses array.
+
### `pool.start()`
This method is available on both pool implementations and will start the minimum number of workers.
})
}
+
+ /** @inheritDoc */
+ public mapExecute (
+ data: Iterable<Data>,
+ name?: string,
+ transferList?: readonly TransferListItem[]
+ ): Promise<Response[]> {
+ return Promise.all(
+ [...data].map(data => this.execute(data, name, transferList))
+ )
+ }
+
/**
* Starts the minimum number of workers.
* @param initWorkerNodeUsage - Whether to initialize the worker node usage or not. @defaultValue false
* @param data - The optional task input data for the specified task function. This can only be structured-cloneable data.
* @param name - The optional name of the task function to execute. If not specified, the default task function will be executed.
* @param transferList - An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the chosen pool's worker_threads worker and they should not be used in the main thread afterwards.
- * @returns Promise that will be fulfilled when the task is completed.
+ * @returns Promise with a task function response that will be fulfilled when the task is completed.
*/
readonly execute: (
data?: Data,
name?: string,
transferList?: readonly TransferListItem[]
) => Promise<Response>
+ /**
+ * Executes the specified function in the worker constructor with the tasks data iterable input parameter.
+ * @param data - The tasks iterable input data for the specified task function. This can only be an iterable of structured-cloneable data.
+ * @param name - The optional name of the task function to execute. If not specified, the default task function will be executed.
+ * @param transferList - An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the chosen pool's worker_threads worker and they should not be used in the main thread afterwards.
+ * @returns Promise with an array of task function responses that will be fulfilled when the tasks are completed.
+ */
+ readonly mapExecute: (
+ data: Iterable<Data>,
+ name?: string,
+ transferList?: readonly TransferListItem[]
+ ) => Promise<Response[]>
/**
* Starts the minimum number of workers in this pool.
*/