Receive a single message from a given MessagePort
. If no message is available,
undefined
is returned, otherwise an object with a single message
property
that contains the message payload, corresponding to the oldest message in the
MessagePort
’s queue.
Stop all JavaScript execution in the worker thread as soon as possible.
Returns a Promise for the exit code that is fulfilled when the exit
event is emitted.
Generated using TypeDoc
Transfer a
MessagePort
to a differentvm
Context. The originalport
object will be rendered unusable, and the returnedMessagePort
instance will take its place.The returned
MessagePort
will be an object in the target context, and will inherit from its globalObject
class. Objects passed to theport.onmessage()
listener will also be created in the target context and inherit from its globalObject
class.However, the created
MessagePort
will no longer inherit fromEventEmitter
, and onlyport.onmessage()
can be used to receive events using it.