fix(quit): Booleans on globals are not exposed through remote properly

This commit is contained in:
Ben Gotow 2016-05-18 15:41:20 -07:00
parent 37eeb5a7a4
commit 8b0f0a2323
3 changed files with 8 additions and 3 deletions

View file

@ -72,6 +72,10 @@ export default class Application extends EventEmitter {
return this.windowManager.get(WindowManager.MAIN_WINDOW).browserWindow;
}
isQuitting() {
return this.quitting;
}
temporaryInitializeDisabledPackages() {
if (this.config.get('core.disabledPackagesInitialized')) {
return;

View file

@ -148,8 +148,7 @@ class NylasWindow
#
# This uses the DOM's `beforeunload` event.
@browserWindow.on 'close', (event) =>
if @neverClose and !global.application.quitting
if @neverClose and !global.application.isQuitting()
# For neverClose windows (like the main window) simply hide and
# take out of full screen.
event.preventDefault()

View file

@ -37,6 +37,8 @@ class WindowEventHandler
window.onbeforeunload = =>
# Don't hide the window here if we don't want the renderer process to be
# throttled in case more work needs to be done before closing
# In Electron, returning false cancels the close.
return @runUnloadCallbacks()
window.onunload = =>
@ -122,7 +124,7 @@ class WindowEventHandler
runUnloadFinished: ->
{remote} = require('electron')
_.defer ->
if remote.getGlobal('application').quitting
if remote.getGlobal('application').isQuitting()
remote.app.quit()
else
NylasEnv.close()