diff --git a/src/window-event-handler.coffee b/src/window-event-handler.coffee index 8e9c8128b..7d52d3134 100644 --- a/src/window-event-handler.coffee +++ b/src/window-event-handler.coffee @@ -39,14 +39,13 @@ class WindowEventHandler # throttled in case more work needs to be done before closing # In Electron, returning any value other than undefined cancels the close. - canCloseWindow = @runUnloadCallbacks() - return undefined if canCloseWindow + if @runUnloadCallbacks() + # Good to go! Window will be closing... + NylasEnv.storeWindowDimensions() + NylasEnv.saveStateAndUnloadWindow() + return undefined return false - window.onunload = => - NylasEnv.storeWindowDimensions() - NylasEnv.saveStateAndUnloadWindow() - NylasEnv.commands.add document.body, 'window:toggle-full-screen', -> NylasEnv.toggleFullScreen()