How can we send messages main process to renderer process in Electron
To send a message back to the renderer you would use:
win.webContents.send('asynchronous-message', {'SAVED': 'File Saved'});
webContents.send
Docs
alternatively - when you want to respond to an event received from renderer process you can do something like this:
ipcMain.on("eventFromRenderer", (event) => {
event.sender.send("eventFromMain", someReply);
}
Source: https://electronjs.org/docs/api/ipc-main