interface MessagePort
implements EventTarget
import { type MessagePort } from "https://deno.land/x/evt@v2.5.2/lib/types/lib.dom.ts";
This Channel Messaging API interface represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
Properties
onmessage: ((this: MessagePort, ev: MessageEvent) => any) | null
onmessageerror: ((this: MessagePort, ev: MessageEvent) => any) | null
Methods
postMessage(message: any, transfer: Transferable[]): void
Posts a message through the channel. Objects listed in transfer are transferred, not just cloned, meaning that they are no longer usable on the sending side.
Throws a "DataCloneError" DOMException if transfer contains duplicate objects or port, or if message could not be cloned.
postMessage(message: any, options?: PostMessageOptions): void
addEventListener<K extends keyof MessagePortEventMap>(): void
type: K,
listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
addEventListener(): void
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
removeEventListener<K extends keyof MessagePortEventMap>(): void
type: K,
listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any,
options?: boolean | EventListenerOptions,