fix(unload): safely unload the task queue on quit

This commit is contained in:
Evan Morikawa 2016-11-05 11:37:11 -07:00
parent 9ec3daff0a
commit ce05e94aeb

View file

@ -73,9 +73,14 @@ class TaskQueue
@_restoreQueue()
@_savedOnUnload = false
NylasEnv.onBeforeUnload((finishUnload) =>
if @_savedOnUnload then return true
@_saveQueue()
.finally(finishUnload)
.finally(() =>
@_savedOnUnload = true
finishUnload()
)
return false
)