mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03: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:
parent
8dffb45fd7
commit
16d2e41309
@ -28,7 +28,7 @@ atom.keymaps.loadBundledKeymaps()
|
|||||||
keyBindingsToRestore = atom.keymaps.getKeyBindings()
|
keyBindingsToRestore = atom.keymaps.getKeyBindings()
|
||||||
|
|
||||||
$(window).on 'core:close', -> window.close()
|
$(window).on 'core:close', -> window.close()
|
||||||
$(window).on 'unload', ->
|
$(window).on 'beforeunload', ->
|
||||||
atom.storeWindowDimensions()
|
atom.storeWindowDimensions()
|
||||||
atom.saveSync()
|
atom.saveSync()
|
||||||
$('html,body').css('overflow', 'auto')
|
$('html,body').css('overflow', 'auto')
|
||||||
|
@ -311,10 +311,10 @@ class Atom extends Model
|
|||||||
@requireUserInitScript()
|
@requireUserInitScript()
|
||||||
@menu.update()
|
@menu.update()
|
||||||
|
|
||||||
$(window).on 'unload', =>
|
$(window).on 'beforeunload', =>
|
||||||
$(document.body).css('visibility', 'hidden')
|
$(document.body).css('visibility', 'hidden')
|
||||||
@unloadEditorWindow()
|
@unloadEditorWindow()
|
||||||
false
|
null
|
||||||
|
|
||||||
@displayWindow()
|
@displayWindow()
|
||||||
|
|
||||||
|
@ -37,11 +37,13 @@ class WindowEventHandler
|
|||||||
@reloadRequested = false
|
@reloadRequested = false
|
||||||
confirmed
|
confirmed
|
||||||
|
|
||||||
@subscribe $(window), 'blur unload', ->
|
@subscribe $(window), 'blur beforeunload', ->
|
||||||
atom.storeDefaultWindowDimensions()
|
atom.storeDefaultWindowDimensions()
|
||||||
|
null
|
||||||
|
|
||||||
@subscribe $(window), 'unload', ->
|
@subscribe $(window), 'beforeunload', ->
|
||||||
atom.storeWindowDimensions()
|
atom.storeWindowDimensions()
|
||||||
|
null
|
||||||
|
|
||||||
@subscribeToCommand $(window), 'window:toggle-full-screen', -> atom.toggleFullScreen()
|
@subscribeToCommand $(window), 'window:toggle-full-screen', -> atom.toggleFullScreen()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user