TaskDefinition

interface TaskDefinition<Request, Response>
packages/workers/src/task.ts:18

Members

namereadonly

name: string

versionreadonly

version: number

Bumped when the payload or result shape changes, checked at dispatch.

run

run(payload: Request, context: TaskContext) → Response | Promise<Response>
payloadRequest
Undocumented
contextTaskContext
Undocumented

transfers

transfers(response: Response) → readonly ArrayBufferLike[]

Buffers to transfer rather than copy. A 65×65 heightfield is 17 KB; a planet's worth of them is not something to structured-clone twice.

responseResponse
Undocumented