Wait for the app ready event before creating windows

Fixes #524
This commit is contained in:
DC
2016-05-17 05:11:42 -07:00
parent b89deb46db
commit eeda7c17c5

View File

@@ -43,6 +43,7 @@ function init () {
app.setPath('userData', config.CONFIG_PATH) app.setPath('userData', config.CONFIG_PATH)
} }
app.isReady = false // app ready, windows can be created
app.ipcReady = false // main window has finished loading and IPC is ready app.ipcReady = false // main window has finished loading and IPC is ready
app.isQuitting = false app.isQuitting = false
@@ -57,6 +58,8 @@ function init () {
}) })
app.on('ready', function () { app.on('ready', function () {
app.isReady = true
windows.createMainWindow() windows.createMainWindow()
windows.createWebTorrentHiddenWindow() windows.createWebTorrentHiddenWindow()
menu.init() menu.init()
@@ -83,7 +86,7 @@ function init () {
}) })
app.on('activate', function () { app.on('activate', function () {
windows.createMainWindow() if (app.isReady) windows.createMainWindow()
}) })
} }