method WorkerPoolService.prototype.run
WorkerPoolService.prototype.run<TInput, TOutput>(
taskModule: string,
input: TInput,
options?: WorkerRunOptions
): Promise<TOutput>

Runs a task on the pool for taskModule, creating it lazily.

Type Parameters

TInput
TOutput

Parameters

taskModule: string

Module specifier of a defineWorkerTask module

input: TInput

Structured-clonable task input

optional
options: WorkerRunOptions

Per-call options

Return Type

Promise<TOutput>

The task's output

Throws

WorkerPoolUnavailableError

When the runtime has no worker support

Usage

import { WorkerPoolService } from "worker-pool-plugin/src/index.ts";