Skip to content

Commit

Permalink
Only Load Page in App Window When It's Visible
Browse files Browse the repository at this point in the history
  • Loading branch information
jaruba committed Feb 6, 2019
1 parent 6422c8c commit 907084d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
18 changes: 4 additions & 14 deletions main.js
Expand Up @@ -144,20 +144,6 @@ function createWindow() {
// and load the index.html of the app.
let indexPath;

mainWindow.loadURL( 'http' + (server.isSSL ? 's': '') + '://127.0.0.1:' + server.port() + '/auth?token=' + server.masterKey );

// Don't show until we are ready and loaded
mainWindow.once('ready-to-show', () => {
// Open the DevTools automatically if developing

// if (process.platform == 'linux')
// mainWindow.show()

if (dev) {
mainWindow.webContents.openDevTools()
}
});

mainWindow.on('close', (e) => {
console.log('window-close')

Expand Down Expand Up @@ -215,10 +201,14 @@ if (process.platform == 'darwin' || process.platform == 'win32') {
}
const showApp = () => {
if (!mainWindow.isVisible()) {
mainWindow.loadURL( 'http' + (server.isSSL ? 's': '') + '://127.0.0.1:' + server.port() + '/auth?token=' + server.masterKey );
mainWindow.show()
mainWindow.focus()
if (app.dock && !app.dock.isVisible())
app.dock.show()
if (dev) {
mainWindow.webContents.openDevTools()
}
} else {
mainWindow.focus()
}
Expand Down
1 change: 1 addition & 0 deletions server/index.js
Expand Up @@ -1646,6 +1646,7 @@ const mainServer = http.createServer(function(req, resp) {
}

if (method == 'closeWindow') {
mainWindow.loadURL( 'about:blank' );
mainWindow.close()
respond({})
return
Expand Down

0 comments on commit 907084d

Please sign in to comment.