Skip to content

Commit af1daa9

Browse files
DeeDeeGAerijo
andcommitted
Move 'window-all-closed' handler to atom-application.js
Co-authored-by: Benjamin Gray <[email protected]>
1 parent fda3c27 commit af1daa9

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/main-process/atom-application.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,16 @@ module.exports = class AtomApplication extends EventEmitter {
773773
})
774774
);
775775

776+
// Don't quit when the last window is closed on macOS. Overrides the default Electron behavior.
777+
// See: https://github.com/electron/electron/blob/v11.1.1/docs/api/app.md#event-window-all-closed
778+
this.disposable.add(
779+
ipcHelpers.on(app, 'window-all-closed', () => {
780+
if (process.platform !== 'darwin') {
781+
app.quit();
782+
}
783+
})
784+
);
785+
776786
// Triggered by the 'open-file' event from Electron:
777787
// https://electronjs.org/docs/api/app#event-open-file-macos
778788
// For example, this is fired when a file is dragged and dropped onto the Atom application icon in the dock.

src/main-process/start.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,6 @@ module.exports = function start(resourcePath, devResourcePath, startTime) {
104104
})
105105
);
106106

107-
// Don't quit when the last window is closed on macOS. Overrides the default Electron behavior.
108-
// See: https://github.com/electron/electron/blob/v11.1.1/docs/api/app.md#event-window-all-closed
109-
app.on('window-all-closed', () => {
110-
if (process.platform !== 'darwin') {
111-
app.quit();
112-
}
113-
});
114-
115107
if (args.userDataDir != null) {
116108
app.setPath('userData', args.userDataDir);
117109
} else if (args.test || args.benchmark || args.benchmarkTest) {

0 commit comments

Comments
 (0)