I am working with electron desktop application using following technologies: Front end : Angular 8 Communication between main process to child process is IPC Renderer Mechanism.
My issue is - when i am sending message from child to main process, after getting response from main to child the window getting reloaded.How to stop reloading, I am using event.preventDefault() but its not working. I don’t want to reload the page.
Sample code .
In child Process i am calling as :
this.es.ipcRenderer.send(‘addGroupmaster’, this.groupForm.value)
In mainproces :
ipcMain.on(‘addGroupmaster’, (event, args) => {
group_master.addGroup(args).then((resp) => {
event.reply('addGroupresponse', resp)
}).catch((error) => {
event.reply('addGroupresponse', error)
});
in child process on method getting page was reloaded. on method is:
this.es.ipcRenderer.on(‘addGroupresponse’, (ev, args) => {
console.log(args)
this.nz.run(() => {
if (args.status == “success”) {
this.es.remote.dialog.showMessageBox(null, { type: “success”, title: “Success”, message: “Group has been Added successfully” });
/**********Event to get all items **********/
this.es.ipcRenderer.send(‘getAllGroups’)
}
else {
this.es.remote.dialog.showMessageBox(null, { type: “error”, title: “Add Failure”, message: args.message });
}
})
Please help me on this.