postMessage

fun postMessage(channel: String, message: Any?, transfer: ReadonlyArray<MessagePortMain> = definedExternally)(source)

Send a message to the renderer process, optionally transferring ownership of zero or more MessagePortMain objects.

The transferred MessagePortMain objects will be available in the renderer process by accessing the ports property of the emitted event. When they arrive in the renderer, they will be native DOM MessagePort objects.

For example: