Skip to content

Documentation / @andrew_l/app / defineWorker

Function: defineWorker() ​

defineWorker<P, S, M, C>(definition): WorkerDefinition<P, S, M, C>

Define a background worker with a pluggable execution strategy. Returns a WorkerDefinition that can be run with createWorkerInstance + startApp.

Type Parameters ​

P ​

P extends ObjectPropsOptions<Data>

S ​

S extends Record<string, any>

M ​

M extends Record<string, AnyFunction>

C ​

C extends WorkerStrategy<Context> = WorkerStrategy<Context>

Parameters ​

definition ​

WorkerDefinition<P, S, M, C>

Returns ​

WorkerDefinition<P, S, M, C>