简体   繁体   中英

Electron Window Open and log Close Event

I'm using Electron for a Desktop Application. I'd liked to open a different Window by a button on main window (index.html).

Therefore, I found BrowserWindow from the Electron API. But I'm totally new in Electron, and I try to get to know the whole Framework.

I have a "a"-link Tag on main window, which is my button. This should open a new defined Electron Window. Maybe by an onclick event?

If the new opened window is closed, on main window a defined Javascript Event like (reload();) should triggered.

So my question is. How is the best way to open a Window and how can i "log" in main window, when the new window is closed an fire my JS-Event.

Thanks

This might help you. It'll execute javascript on your Main Window when the New Window is closed.

newWindow.on('closed', function(e){
        mainWindow.webContents.executeJavaScript(`alert("test");`);
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM