I have a renderer process, let's call it RP. On a button click, it opens a browserwindow (BW).
Now when close is clicked on BW, I would like to catch this close event in RP and prevent it.
I am experiencing, that the window is closed, before the close event is called in RP.
Code:
bw.on("close", (e: Electron.Event) => hideWindow(e));
let hideWindow = (e: Electron.Event) => {
e.preventDefault();
bw.hide();
return false;
}
What am I doing wrong?
I am aware, that in bw I can use beforeunload, which works. But I want the RP to control whether the window closes or not.