本文出处:https://blog.csdn.net/qq_33040483/article/details/103026442
此作笔记以备用
const electron = require('electron');
const app = electron.app;
let willQuitApp = false;
let window;
app.on('ready', () => {
window = new electron.BrowserWindow();
window.on('close', (e) => {
if (willQuitApp) {
window = null;
} else {
e.preventDefault();
window.hide();
}
});
window.loadURL('foobar');
});
app.on('activate', () => window.show());
app.on('before-quit', () => willQuitApp = true);