Skip to content

TElectronIPCRenderer

Below is a list of the available methods for TElectronIPCRenderer. This class allows listening to channels and sending messages to channels. It's used in the TElectronIPCCommunication component. Instead of creating a TElectronIPCRenderer instance, ElectronIPCRenderer can be used.

Methods for TElectronIPCRenderer

Property Description
Listen(Channel: string; Listener: TIPCEventHandler) Method to set a listener for a defined channel. The Listener will be invoked everytime a message arrives onto the given channel. Multiple listeners can be assigned to the same channel.
ListenOnce(Channel: string; Listener: TIPCEventHandler) Method to set a listener for a defined channel that will be executed only once - when the first message arrives onto the channel.
RemoveAllListeners(Channel: string) Method to remove all listeners on the defined channel.
Send(Channel: string; JSObject: JSValue) Method to send a message to the given channel.
Send(Channel: string; AMessage: string) Method to send a message to the given channel.

The listeners (= callbacks) passed to the main process will persist until the main process garbage-collects them. Therefore it's important to uninstall the listeners using the 'RemoveAllListeners' method. More information on this can be found in the Electron documentation: https://electronjs.org/docs/api/remote