DWVv0.37.0

WorkerThread

Source: thread.js:271

Worker thread.


Constructor

new WorkerThread(parentPool: ThreadPool): WorkerThread

Parameters


Instance Methods

getId(): string

Get the thread ID.

Returns

  • string — The thread ID (alphanumeric).

run(workerTask: WorkerTask)

Run a worker task.

Parameters

stop()

Finish a task.

Instance Fields

parentPool: ThreadPool

id: string

runningTask: WorkerTask

worker: Worker

onmessage

Message event handler. For now assume we only get a single callback from a worker which also indicates the end of this worker.

Parameters

  • event (object) — The message event.

onerror

Error event handler.

Parameters

  • event (object) — The error event.