Worker implementation. All defined workers MUST be terminated until application shut down. In opposite case you can get AV.

# new Worker (paramsObjObject)

Arguments:
  • paramsObj: Object| Number
    • name='Worker'String

      Name of Worker for debugger

    • moduleNameString | function

      Module name. Module must export 3 function: onmessage, onterminate and onerror

    • message*

      Message. If assigned then post this message after start thread

    Parameters object for create new Worker or WorkerID for use existing Worker

Members

# name instance

Name Type Description
name string

Worker name

# workerID instance

Name Type Description
workerID Number

Worker ID

Methods

# getMessage () → * instance

Get message from the worker thread

# postMessage (message*) instance

Post message to worker thread. Message are stringified before send

Arguments:
  • message: *

# terminate () instance

Terminate worker thread

# waitMessage (timeoutNumber, checkEveryMSoptNumber) → * instance

Try get message from worker thread. Wait until message received or timeout expired

Arguments:
  • timeout: Number

    Timeout in milliseconds

  • checkEveryMS = 10: Number

    Sleep duration before next try get message