This seems like it should be simple. I have a line in main.js that reads:
event.sender.send("name-prompt")
I know that this is being called, I got a warning when I tried to pass in event
. Then in index.js
I have
ipcRenderer.on("name-prompt", () => {
console.log("why isn't this working")
document.getElementById("details-prompt").classList.add("visibility-override")
})
And this just never runs. webContents.send and ipcRenderer.on Not Working uses webContents.send, which as I understand it is distinct from event.sender.send. I'm definitely very new to electron, so there's a lot I'm missing. What should I do to make this work?
Edit: full code for IPCMain.on
ipcMain.on("add-from-file-clicked", (event) => {
dialog.showOpenDialog({ properties: ['openFile'] }).then(result => {
console.log(result.canceled);
console.log(result.filePaths);
if (!result.canceled) {
event.sender.send("name-prompt")
}
})
})
And yes, I've verified that result.canceled is false. Thanks!