Refactor main.js: fix state save on exit

This commit is contained in:
DC
2016-07-08 11:20:56 -07:00
parent dfe1e3b631
commit 7050ee849b
3 changed files with 19 additions and 18 deletions

View File

@@ -90,7 +90,10 @@ function init () {
e.preventDefault()
windows.main.dispatch('saveState') // try to save state on exit
ipcMain.once('savedState', () => app.quit())
setTimeout(() => app.quit(), 2000) // quit after 2 secs, at most
setTimeout(() => {
console.error('Saving state took too long. Quitting.')
app.quit()
}, 2000) // quit after 2 secs, at most
})
app.on('activate', function () {