MessagePortMain

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun addListener(event: MessagePortMainEvent.MESSAGE, listener: (messageEvent: MessageEvent) -> Unit)
Link copied to clipboard
fun close()

Disconnects the port, so it is no longer active.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun off(event: MessagePortMainEvent.MESSAGE, listener: (messageEvent: MessageEvent) -> Unit)
Link copied to clipboard
fun on(event: MessagePortMainEvent.CLOSE, listener: Function<Unit>)

Emitted when the remote end of a MessagePortMain object becomes disconnected.

fun on(event: MessagePortMainEvent.MESSAGE, listener: (messageEvent: MessageEvent) -> Unit)

Emitted when a MessagePortMain object receives a message.

Link copied to clipboard
fun once(event: MessagePortMainEvent.MESSAGE, listener: (messageEvent: MessageEvent) -> Unit)
Link copied to clipboard
fun postMessage(message: Any?, transfer: ReadonlyArray<MessagePortMain> = definedExternally)

Sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun start()

Starts the sending of messages queued on the port. Messages will be queued until this method is called.