mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
ELECTRON-591 - Add logic to close up child windows whenever parent window is navigated or reloaded (#446)
This commit is contained in:
committed by
Vishwas Shashidhar
parent
f893b5658c
commit
75d2e06673
@@ -1102,6 +1102,27 @@ function handleKeyPress(keyCode) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all the child window and closes it
|
||||
*/
|
||||
function cleanUpChildWindows() {
|
||||
const browserWindows = BrowserWindow.getAllWindows();
|
||||
notify.resetAnimationQueue();
|
||||
if (browserWindows && browserWindows.length) {
|
||||
browserWindows.forEach(browserWindow => {
|
||||
// Closes only child windows
|
||||
if (browserWindow && !browserWindow.isDestroyed() && browserWindow.winName !== 'main') {
|
||||
// clean up notification windows
|
||||
if (browserWindow.winName === 'notification-window') {
|
||||
notify.closeAll();
|
||||
} else {
|
||||
browserWindow.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
createMainWindow: createMainWindow,
|
||||
@@ -1115,5 +1136,6 @@ module.exports = {
|
||||
verifyDisplays: verifyDisplays,
|
||||
getMenu: getMenu,
|
||||
setIsAutoReload: setIsAutoReload,
|
||||
handleKeyPress: handleKeyPress
|
||||
handleKeyPress: handleKeyPress,
|
||||
cleanUpChildWindows: cleanUpChildWindows,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user