OS X: Prevent white flash on window open

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
(https://github.com/atom/electron/issues/861) we can remove the timeout.
This commit is contained in:
Feross Aboukhadijeh
2016-03-27 00:27:28 -07:00
parent e1737641ab
commit 8d7424d19d
2 changed files with 4 additions and 5 deletions

View File

@@ -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)

View File

@@ -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)