添加重启应用功能,支持通过触摸事件触发重启
This commit is contained in:
@@ -368,6 +368,11 @@ app.whenReady().then(() => {
|
||||
return "stopped";
|
||||
});
|
||||
|
||||
ipcMain.on("restart-app", () => {
|
||||
app.relaunch();
|
||||
app.exit(0);
|
||||
});
|
||||
|
||||
app.on("activate", () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow();
|
||||
|
||||
@@ -4,7 +4,8 @@ contextBridge.exposeInMainWorld("electronAPI", {
|
||||
// 获取PDF(绕过CORS)
|
||||
fetchPdf: (pdfUrl) => ipcRenderer.invoke("fetch-pdf", pdfUrl),
|
||||
// 打印PDF
|
||||
printPdf: (pdfUrl, options) => ipcRenderer.invoke("print-pdf", pdfUrl, options),
|
||||
printPdf: (pdfUrl, options) =>
|
||||
ipcRenderer.invoke("print-pdf", pdfUrl, options),
|
||||
// 获取打印机列表
|
||||
getPrinters: () => ipcRenderer.invoke("get-printers"),
|
||||
startIdCardListen: () => ipcRenderer.invoke("start_idcard_listen"),
|
||||
@@ -18,4 +19,5 @@ contextBridge.exposeInMainWorld("electronAPI", {
|
||||
ipcRenderer.removeAllListeners("idcard-data");
|
||||
ipcRenderer.removeAllListeners("idcard-error");
|
||||
},
|
||||
restartApp: () => ipcRenderer.send("restart-app"),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user