Amos Hack
Amos Hack

Reputation: 65

In Electron App,app.quit()&&ap.exit(0) can not teminate the process,how to deal with this?

my computer is mac, Cmd+Qcan not quit the electron app! why? What should I do? enter image description here

enter image description here

enter image description here

Upvotes: 3

Views: 4511

Answers (1)

Piero Divasto
Piero Divasto

Reputation: 1135

According to the documentation of the method app.exit(exitCode):

All windows will be closed immediately without asking user and the before-quit and will-quit events will not be emitted.

So on On OS X it is common for applications and their menu bar to stay active. Try the following or change the method app.exit() by app.quit()

app.on('window-all-closed', function () {
  if (process.platform !== 'darwin') {
    app.quit();
  }
});

Upvotes: 5

Related Questions