javascript - 在Electron App中,app.quit()&&.exit(0)无法终止进程,如何处理?

标签 javascript electron

我的电脑是mac,Cmd+Q无法退出 Electron 应用!为什么?我该怎么办? enter image description here

enter image description here

enter image description here

最佳答案

根据方法的文档app.exit(exitCode) :

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

因此,在 OS X 上,应用程序及其菜单栏保持事件状态是很常见的。请尝试以下操作或将方法 app.exit() 更改为 app.quit()

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

关于javascript - 在Electron App中,app.quit()&&.exit(0)无法终止进程,如何处理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38653528/

相关文章:

javascript - 为传入数据数组生成唯一的 div

javascript - 如何附加此文本而不是替换它?

javascript - 如何使用 javascript 显示/隐藏跨度

node.js - 在 Electron 中使用 NodeJS 插件

node.js - 如何使 SQLite 与 Angular 4+、Electron 和 NodeJS 一起工作

javascript - Fancy Box 2 - 单击时窗口跳转到顶部

java - Jquery购物车插件: Implementing Session Management

javascript - Electron setTimeout 在渲染器进程中返回数字而不是 Timeout 对象

reactjs - Bootstrap 4, react : how to change the title of a tooltip?

javascript - Electron ,最小化屏幕