添加应用退出功能,支持通过长按触摸事件触发退出
This commit is contained in:
@@ -372,6 +372,14 @@ app.whenReady().then(() => {
|
||||
app.relaunch();
|
||||
app.exit(0);
|
||||
});
|
||||
ipcMain.on("quit-app", () => {
|
||||
try {
|
||||
app.quit();
|
||||
} catch (err) {
|
||||
// 最后手段:强制退出
|
||||
app.exit(0);
|
||||
}
|
||||
});
|
||||
|
||||
app.on("activate", () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
|
||||
@@ -20,4 +20,5 @@ contextBridge.exposeInMainWorld("electronAPI", {
|
||||
ipcRenderer.removeAllListeners("idcard-error");
|
||||
},
|
||||
restartApp: () => ipcRenderer.send("restart-app"),
|
||||
quitApp: () => ipcRenderer.send("quit-app"),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user