Skip to content
English

defineOffloadTask

defineOffloadTask<TArgs, TResult>(module, exportName): OffloadTask<TArgs, TResult>

Defined in: src/worker/OffloadTask.ts:29

Name a task. Resolve the module against the caller, as in defineOffloadTask(new URL('./hash.js', import.meta.url), 'hashPassword'); a bundler that inlines modules is the one environment this does not survive, and the docs say so. The type parameters are what pool.run checks the arguments and the result against.

TArgs extends readonly unknown[]

TResult

string | URL

string

OffloadTask<TArgs, TResult>