Getter and setter. Set a function which is called each time a
message is received. The function is called with a single argument.
It is an object with a data
property containing the received
message. The thread is not terminated if there is at least one non
null
onmessage handler.
Static
Optional
parentIn the created worker, Worker.parent
represents the parent worker
and is used to send or receive messages.
Send a message to the corresponding worker. msg is cloned in the destination worker using an algorithm similar to the HTML structured clone algorithm. SharedArrayBuffer are shared between workers.
Current limitations: Map
and Set
are not supported yet.
Generated using TypeDoc
Constructor to create a new thread (worker) with an API close to the
WebWorkers
.module_filename
is a string specifying the module filename which is executed in the newly created thread. As for dynamically imported module, it is relative to the current script or module path. Threads normally don’t share any data and communicate between each other with messages. Nested workers are not supported. An example is available intests/test_worker.js
.