WorkerThread

Worker thread.

Constructor

new WorkerThread(parentPool)

Parameters:
NameTypeDescription
parentPoolobject

The parent pool.

Members

onerror

Error event handler.

onmessage

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

Methods

getId() → {string}

Get the thread ID.

Returns:

The thread ID (alphanumeric).

Type: 
string

run(workerTask)

Run a worker task.

Parameters:
NameTypeDescription
workerTaskobject

The task to run.

stop()

Finish a task and tell the parent.