postMessage
abstract fun postMessage(channel: String, message: Any?, transfer: ReadonlyArray<MessagePort> = definedExternally)(source)
Send a message to the main process, optionally transferring ownership of zero or more MessagePort
objects.
The transferred MessagePort
objects will be available in the main process as MessagePortMain
objects by accessing the ports
property of the emitted event.
For example:
For more information on using MessagePort
and MessageChannel
, see the MDN documentation.