electron/spec/fixtures/api/exit-closes-all-windows-app/main.js

20 lines
368 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
const windows = [];
function createWindow (id) {
2020-03-20 20:28:31 +00:00
const window = new BrowserWindow({ show: false });
window.loadURL(`data:,window${id}`);
windows.push(window);
}
app.whenReady().then(() => {
for (let i = 1; i <= 5; i++) {
2020-03-20 20:28:31 +00:00
createWindow(i);
}
setImmediate(function () {
2020-03-20 20:28:31 +00:00
app.exit(123);
});
});