Open footcoderr opened 8 months ago
You can just add it yourself. I used it in my project here, idk if this is what you're asking but here's my code
Preload.ts:
import { contextBridge, ipcRenderer, BrowserWindow } from 'electron'
contextBridge.exposeInMainWorld('ipcRenderer', {
invoke: (channel: string, ...args: any[]): Promise<any> => ipcRenderer.invoke(channel, ...args),
removeAllListeners: (channel: string): Electron.IpcRenderer => ipcRenderer.removeAllListeners(channel),
reload: (channel: string): Promise<any> => ipcRenderer.invoke('reload-window'),
})
In your react component:
const handleDeleteButton = () => {
window.ipcRenderer.invoke("reload-window", projectName);
};
In background.ts:
ipcMain.handle('reload-window', async (_event, _args) => {
mainWindow?.reload();
});
@footcoderr did you find a solution ?
Is there a reason why you didn't add 'invoke' on ipc in preload?
I've been using it useful because I've requested and received a response from the data. Is there a better way to do this?