mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 08:16:09 +08:00
fix(quit): Booleans on globals are not exposed through remote properly
This commit is contained in:
parent
37eeb5a7a4
commit
8b0f0a2323
|
@ -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;
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue