Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface MessagePort

Hierarchy

Index

Properties

EventTarget

EventTarget: object

Type declaration

  • constructor: function
    • Returns EventTarget

  • prototype: EventTarget

onmessage

onmessage: function | null

onmessageerror

onmessageerror: function | null

Methods

addEventListener

close

  • close(): void
  • Disconnects the port, so that it is no longer active.

    Returns void

dispatchEvent

  • dispatchEvent(event: Event): boolean
  • Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

    Parameters

    Returns boolean

postMessage

  • 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.

    Parameters

    Returns void

removeEventListener

start

  • start(): void
  • Begins dispatching messages received on the port.

    Returns void

Generated using TypeDoc