Constructor
new Worker(paramsObj)
Arguments:
-
paramsObj
(Object)
 Parameters objectProperties
-
onmessage
(String|function)
 Message handler. Accept 1 parameter - message -
onterminate
(String|function)
 Terminate handler. Accept no parameters -
onerror
(String|function)
 Error handler. Accept 2 parameters - message and exception -
message
 Message. If assigned then post this message after start thread
-
Methods
getMessage() → *
Get message from the worker thread
waitMessage(timeout, checkEveryMSopt) → *
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
terminate()
Terminate worker thread
postMessage(message)
Post message to worker thread. Message are stringified before send
Arguments:
-
message
(*)
timeout
(Number)
 Timeout in milliseconds
[checkEveryMS=10]
(Number)
 Sleep duration before next try get message
message
(*)