mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 10:12:00 +08:00
fix(window-state): Per electron#7278, save state in beforeunload
Related: https://github.com/electron/electron/issues/7278 https://github.com/atom/atom/pull/3223/files As of Chromium 36, unload is async and @zcbenz does not think it happens reliabily in Electron. Move saving of window state to beforeunload, following suit with Atom.
This commit is contained in:
parent
f62caa9c57
commit
9ddb713a1b
1 changed files with 5 additions and 6 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue