mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Use beforeunload instead of unload
unload is asynchronous in Chrome 36 and so saving the state while reloading may not happen before the state is read on the new render process.
This commit is contained in:
@@ -311,10 +311,10 @@ class Atom extends Model
|
||||
@requireUserInitScript()
|
||||
@menu.update()
|
||||
|
||||
$(window).on 'unload', =>
|
||||
$(window).on 'beforeunload', =>
|
||||
$(document.body).css('visibility', 'hidden')
|
||||
@unloadEditorWindow()
|
||||
false
|
||||
null
|
||||
|
||||
@displayWindow()
|
||||
|
||||
|
||||
@@ -37,11 +37,13 @@ class WindowEventHandler
|
||||
@reloadRequested = false
|
||||
confirmed
|
||||
|
||||
@subscribe $(window), 'blur unload', ->
|
||||
@subscribe $(window), 'blur beforeunload', ->
|
||||
atom.storeDefaultWindowDimensions()
|
||||
null
|
||||
|
||||
@subscribe $(window), 'unload', ->
|
||||
@subscribe $(window), 'beforeunload', ->
|
||||
atom.storeWindowDimensions()
|
||||
null
|
||||
|
||||
@subscribeToCommand $(window), 'window:toggle-full-screen', -> atom.toggleFullScreen()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user