mirror of
https://github.com/atom/atom.git
synced 2026-02-12 15:45:23 -05:00
Merge pull request #17873 from atom/fb-sh-close-on-unload
During quit, close unloaded windows
This commit is contained in:
@@ -437,7 +437,14 @@ class AtomApplication extends EventEmitter {
|
||||
if (!this.quitting) {
|
||||
this.quitting = true
|
||||
event.preventDefault()
|
||||
const windowUnloadPromises = this.getAllWindows().map(window => window.prepareToUnload())
|
||||
const windowUnloadPromises = this.getAllWindows().map(async window => {
|
||||
const unloaded = await window.prepareToUnload()
|
||||
if (unloaded) {
|
||||
window.close()
|
||||
await window.closedPromise
|
||||
}
|
||||
return unloaded
|
||||
})
|
||||
const windowUnloadedResults = await Promise.all(windowUnloadPromises)
|
||||
if (windowUnloadedResults.every(Boolean)) {
|
||||
app.quit()
|
||||
|
||||
Reference in New Issue
Block a user