The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on.
The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).
MDN
Disconnects the port,so it is no longer active.
Disconnects the port,so it is no longer active. This stops the flow of messages to that port.
MDN
Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order.
Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) apply to events dispatched manually with dispatchEvent().
MDN
An EventListener, called whenever an MessageEvent of type message is fired on the port — that is, when the port receives a message.
An EventListener, called whenever an MessageEvent of type message is fired on the port — that is, when the port receives a message.
MDN
Sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
Sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
The message you want to send through the channel. This can be of any basic data type. Multiple data items can be sent as an array.
Removes the event listener previously registered with EventTarget.addEventListener.
Removes the event listener previously registered with EventTarget.addEventListener.
MDN
The MessagePort interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing sending of messages from one port and listening out for them arriving at the other.
MDN