mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 17:31:36 -06:00
use correct event when browserWin finally closes (#60)
This commit is contained in:
parent
b2fcf1afc2
commit
7477437c6d
@ -114,7 +114,7 @@ function createMainWindow(initialUrl) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function destroyAllWindows() {
|
function destroyAllWindows() {
|
||||||
var keys = Object.keys(windows);
|
let keys = Object.keys(windows);
|
||||||
for(var i = 0, len = keys.length; i < len; i++) {
|
for(var i = 0, len = keys.length; i < len; i++) {
|
||||||
let winKey = keys[i];
|
let winKey = keys[i];
|
||||||
removeWindowKey(winKey);
|
removeWindowKey(winKey);
|
||||||
@ -143,8 +143,9 @@ function createMainWindow(initialUrl) {
|
|||||||
// abort - no frame name provided.
|
// abort - no frame name provided.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reposition new window
|
// reposition new window
|
||||||
var mainWinPos = mainWindow.getPosition();
|
let mainWinPos = mainWindow.getPosition();
|
||||||
if (mainWinPos && mainWinPos.length === 2) {
|
if (mainWinPos && mainWinPos.length === 2) {
|
||||||
let newWinKey = getGuid();
|
let newWinKey = getGuid();
|
||||||
|
|
||||||
@ -155,18 +156,20 @@ function createMainWindow(initialUrl) {
|
|||||||
newWinOptions.winKey = newWinKey;
|
newWinOptions.winKey = newWinKey;
|
||||||
/* eslint-enable no-param-reassign */
|
/* eslint-enable no-param-reassign */
|
||||||
|
|
||||||
// note: will use code below later for saved layout impl.
|
let webContents = newWinOptions.webContents;
|
||||||
var webContents = newWinOptions.webContents;
|
|
||||||
webContents.once('did-finish-load', function() {
|
webContents.once('did-finish-load', function() {
|
||||||
|
let browserWin = electron.BrowserWindow.fromWebContents(webContents);
|
||||||
|
|
||||||
var browserWin = electron.BrowserWindow.fromWebContents(webContents);
|
if (browserWin) {
|
||||||
browserWin.winName = frameName;
|
browserWin.winName = frameName;
|
||||||
|
|
||||||
addWindowKey(newWinKey, browserWin);
|
browserWin.once('closed', function() {
|
||||||
|
removeWindowKey(newWinKey);
|
||||||
|
});
|
||||||
|
|
||||||
browserWin.once('close', function() {
|
addWindowKey(newWinKey, browserWin);
|
||||||
removeWindowKey(newWinKey);
|
}
|
||||||
});
|
|
||||||
|
|
||||||
// note: will use later for save-layout feature
|
// note: will use later for save-layout feature
|
||||||
// browserWin.on('move', function() {
|
// browserWin.on('move', function() {
|
||||||
@ -215,10 +218,11 @@ function setIsOnline(status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function activate(windowName) {
|
function activate(windowName) {
|
||||||
var keys = Object.keys(windows);
|
let keys = Object.keys(windows);
|
||||||
for(var i = 0, len = keys.length; i < len; i++) {
|
for(let i = 0, len = keys.length; i < len; i++) {
|
||||||
var window = windows[keys[i]];
|
let window = windows[keys[i]];
|
||||||
if (window.winName === windowName) {
|
if (window && !window.isDestroyed() &&
|
||||||
|
window.winName === windowName) {
|
||||||
window.show();
|
window.show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user