Skip to main content
MessagePort.postMessage - Messaging - Web documentation
method MessagePort.postMessage
Private
MessagePort.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

message: any
transfer: Transferable[]

Return Type

void
MessagePort.postMessage(
message: any,
): void

Parameters

message: any
optional
options: StructuredSerializeOptions

Return Type

void