2020-04-04 15:32:27 +02:00
|
|
|
const { app, BrowserWindow } = require("electron");
|
|
|
|
|
|
|
|
const createWindow = () => {
|
|
|
|
// Create the browser window.
|
|
|
|
let win = new BrowserWindow({
|
|
|
|
width: 800,
|
|
|
|
height: 600,
|
|
|
|
webPreferences: {
|
|
|
|
nodeIntegration: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2020-04-04 17:15:43 +02:00
|
|
|
win.loadURL(`http://localhost:${process.env.EXPRESS_PORT || 3000}`);
|
2020-04-04 15:32:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
app.whenReady().then(createWindow);
|
|
|
|
|
|
|
|
// Quit when all windows are closed.
|
|
|
|
app.on("window-all-closed", () => {
|
|
|
|
// On macOS it is common for applications and their menu bar
|
|
|
|
// to stay active until the user quits explicitly with Cmd + Q
|
|
|
|
if (process.platform !== "darwin") {
|
|
|
|
app.quit();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
app.on("activate", () => {
|
|
|
|
// On macOS it's common to re-create a window in the app when the
|
|
|
|
// dock icon is clicked and there are no other windows open.
|
2020-04-05 12:36:01 +02:00
|
|
|
if (BrowserWindow.getAllWindows().length == 0) {
|
2020-04-04 15:32:27 +02:00
|
|
|
createWindow();
|
|
|
|
}
|
|
|
|
});
|