import { ipcRenderer, contextBridge } from "electron"; // --------- Expose some API to the Renderer process --------- contextBridge.exposeInMainWorld("ipcRenderer", { on(...args: Parameters) { const [channel, listener] = args; return ipcRenderer.on(channel, (event, ...args) => listener(event, ...args) ); }, off(...args: Parameters) { const [channel, ...omit] = args; return ipcRenderer.off(channel, ...omit); }, send(...args: Parameters) { const [channel, ...omit] = args; return ipcRenderer.send(channel, ...omit); }, invoke(...args: Parameters) { const [channel, ...omit] = args; return ipcRenderer.invoke(channel, ...omit); }, once: (...args: Parameters) => { const [channel, ...omit] = args; return ipcRenderer.once(channel, ...omit); }, });