on

abstract fun on(channel: String, listener: Function<Unit>)(source)

Listens to channel, when a new message arrives listener would be called with listener(event, args...).

:::warning Do not expose the event argument to the renderer for security reasons! Wrap any callback that you receive from the renderer in another function like this: ipcRenderer.on('my-channel', (event, ...args) => callback(...args)). Not wrapping the callback in such a function would expose dangerous Electron APIs to the renderer process. See the security guide for more info. :::