Skip to content

ElectronIpcRenderer.postMessage method

ElectronIpcRenderer › postMessage

Unofficial

Sends a message to the main process, optionally transferring ownership of zero or more MessagePort objects. The transferred ports are available in the main process as MessagePortMain objects via the ports property of the emitted event.

Signature:

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

Parameters:

Parameter Type Description
channel string The IPC channel name.
message unknown The message to send.
transfer? MessagePort[] | undefined Optional transferable MessagePort objects.

Returns: void