Electron & Electron Builder

This commit is contained in:
2024-11-02 18:09:44 +01:00
parent 201714403c
commit aeb28fe5a7
9 changed files with 8007 additions and 1307 deletions

View File

@@ -0,0 +1,46 @@
const { app, BrowserWindow } = require("electron");
const path = require("path");
const backend = require('./../backend/server')
/**
* Create the application window
*/
function createWindow() {
const win = new BrowserWindow({
width: 1400,
height: 800,
webPreferences: {
preload: path.join(__dirname, "preload.js"),
},
});
// Load HTML entry point
win.loadFile("build/src/vite/index.html");
// Maximize window
win.maximize()
// Remove menu bar
win.removeMenu()
}
app.whenReady().then(() => {
createWindow();
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
// Close the expressjs backend server on application termination
backend.close(() => {
process.exit(0)
})
});