Provides an object where messages can be sent and received through a MessageChannel.
The MessagePort object has these types of members:
The MessagePort object has these events.
Returns a message from the parent thread to the worker thread, or between two MessagePort objects.
The MessagePort object has these methods.
Registers an event handler for the specified event type.
Closes a MessagePort from an existing MessageChannel.
Sends an event to the current element.
Sends messages between two connected MessagePorts in a MessageChannel.
Removes an event handler that the addEventListener method registered.
Allows the MessagePort to begin receiving messages.
Two MessagePort objects are automatically created when a MessageChannel object is created, and are returned by the port1 and port2 properties. Messages are sent from one port are received by the other, and vice versa.
The MessagePort object provides the start method to begin dispatching messages received on the port, and the close method to close and disconnect the port. The postMessage method sends messages through the port.
For more info, see MessageChannel for a working messaging demo.