Hi I'm requesting two results from the main process but when I click the button, the app keeps freezing. Even devtools is not working .
ipcMain.on('fmail', (event, arg) => {
var fmaile = even
var fmaila = arg
ipcMain.on('fpass', (event, arg) => {
var fpasse = event
var fpassa = arg
console.log(fpassa)
console.log(fmaila)
fmaile.returnValue = "info"
fpasse.returnValue = "info"
})
})
var datamail = ipcRenderer.sendSync('fmail', "fmail");
var datapass = ipcRenderer.sendSync('fpass', "fpass");
console.log(datamail)
console.log(datapass)
Thanks for help.
The docs is pretty clear on this one:
Sending a synchronous message will block the whole renderer process, unless you know what you are doing you should never use it.
Since you don't provide a return value in your fmail
callback, no wonder it blocks your app.
Also, I guess you wanted to register both listeners individually. What you currently have is "add listener to 'fpass' every time 'fmail' is called back"
Your code should probably look like this (but cannot tell exactly really)
ipcMain.on('fmail', (event, arg) => {
console.log(arg)
event.returnValue = "info"
})
ipcMain.on('fpass', (event, arg) => {
console.log(arg)
event.returnValue = "info"
})
console.log(
ipcRenderer.sendSync('fmail', "fmail"),
ipcRenderer.sendSync('fpass', "fpass")
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With