program runs normally. After executing app.quit ()
or pressing < kbd > quit < / kbd > + < kbd > Q < / kbd >, the program is always prompted to exit unexpectedly, with a probability of 101%
(whether it"s dev or packaged macos applications)
< H2 >
main.js
Code: < / H2 >
const path = require("path")
const { app, BrowserWindow } = require("electron")
const { creatTray } = require("./tray")
const { createWindow } = require("./window")
const { NODE_ENV } = process.env
let tray
if (NODE_ENV === "development") {
// react-developer-tools
require("electron-debug")({ showDevTools: false })
app.on("ready", () => {
let installExtension = require("electron-devtools-installer")
installExtension.default(installExtension.REACT_DEVELOPER_TOOLS).then(() => {
}).catch(err => {
console.log("Unable to install `react-developer-tools`: \n", err)
})
})
}
app.on("ready", () => {
tray = creatTray()
createWindow("home")
})
app.on("window-all-closed", e => {
})
app.on("quit", e => {
tray.destroy()
})