mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Do unload work in 'unload' event handler instead of 'beforeunload'.
In Atom, the 'beforeunload' event never prevents window from closing so it in fact has the same effect with 'unload' event, I guess using 'beforeunload' instead of 'unload' is because the 'beforeunload' is guarrenteed to happen when window is closing or application is quiting. However in Atom Shell the 'unload' event is guarrenteed to happen on both conditions, just like the 'beforeunload' in Atom, so it's safe to replace the 'beforeunload' with 'unload' here. And in Atom Shell, the 'beforeunload' event is mainly used for preventing window from closing, just like the 'window:close' command in Atom.
This commit is contained in:
@@ -52,7 +52,7 @@ window.startEditorWindow = ->
|
||||
atom.activatePackages()
|
||||
keymap.loadUserKeymaps()
|
||||
atom.requireUserInitScript()
|
||||
$(window).on 'beforeunload', -> unloadEditorWindow(); false
|
||||
$(window).on 'unload', -> unloadEditorWindow(); false
|
||||
$(window).focus()
|
||||
|
||||
window.startConfigWindow = ->
|
||||
@@ -65,7 +65,7 @@ window.startConfigWindow = ->
|
||||
deserializeConfigWindow()
|
||||
atom.activatePackageConfigs()
|
||||
keymap.loadUserKeymaps()
|
||||
$(window).on 'beforeunload', -> unloadConfigWindow(); false
|
||||
$(window).on 'unload', -> unloadConfigWindow(); false
|
||||
$(window).focus()
|
||||
|
||||
window.unloadEditorWindow = ->
|
||||
|
||||
Reference in New Issue
Block a user