electron/spec/fixtures/api/window-all-closed/main.js

25 lines
453 B
JavaScript
Raw Normal View History

2020-03-20 20:28:31 +00:00
const { app, BrowserWindow } = require('electron');
2020-03-20 20:28:31 +00:00
let handled = false;
if (app.commandLine.hasSwitch('handle-event')) {
app.on('window-all-closed', () => {
2020-03-20 20:28:31 +00:00
handled = true;
app.quit();
});
}
app.on('quit', () => {
2020-03-20 20:28:31 +00:00
process.stdout.write(JSON.stringify(handled));
process.stdout.end();
});
app.whenReady().then(() => {
const win = new BrowserWindow({
webPreferences: {
contextIsolation: true
}
});
2020-03-20 20:28:31 +00:00
win.close();
});