Skip to content

Commit

Permalink
OS X: Prevent white flash on window open
Browse files Browse the repository at this point in the history
We got the window to run less JS but now it’s shown by the main process
too soon! This fixes that with a setTimeout.

Perhaps when this issue is fixed
(electron/electron#861) we can remove the timeout.
  • Loading branch information
feross committed Mar 27, 2016
1 parent 6465c23 commit 589880f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 4 additions & 1 deletion main/ipc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ var powerSaveBlockID = 0

function init () {
ipcMain.on('ipcReady', function (e) {
console.timeEnd('init')
app.ipcReady = true
app.emit('ipcReady')
setTimeout(function () {
windows.main.show()
console.timeEnd('init')
}, 50)
})

ipcMain.on('showOpenTorrentFile', menu.showOpenTorrentFile)
Expand Down
4 changes: 0 additions & 4 deletions main/windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ function createMainWindow () {
menu.onToggleFullScreen()
})

win.webContents.on('did-finish-load', function () {
win.show()
})

win.on('blur', menu.onWindowHide)
win.on('focus', menu.onWindowShow)

Expand Down

0 comments on commit 589880f

Please sign in to comment.