const { contextBridge, ipcRenderer } = require('electron'); contextBridge.exposeInMainWorld('electronApi', { sendMessage: async (channelNameArg, payloadArg) => { ipcRenderer.send(channelNameArg, payloadArg); }, receiveMessage: (channelNameArg, func) => { ipcRenderer.on(channelNameArg, (event, ...args) => func(...args)); }, });