Skip to content

ElectronWebContents.postMessage method

ElectronWebContents › postMessage

Unofficial

Sends a message to the renderer process, optionally transferring ownership of message ports.

Signature:

postMessage(channel: string, message: unknown, transfer?: ElectronMessagePortMain[] | undefined): void

Parameters:

ParameterTypeDescription
channelstringThe channel name.
messageunknownThe message to send.
transfer?ElectronMessagePortMain[] | undefinedMessage ports whose ownership is transferred with the message.

Returns: void