const { app, BrowserWindow } = require("electron"); const path = require("node:path"); function createWindow() { const win = new BrowserWindow({ width: 1280, height: 800, title: "Dispatch", webPreferences: { nodeIntegration: false, contextIsolation: true, preload: path.join(__dirname, "preload.cjs"), }, }); win.loadFile(path.join(__dirname, "../dist/index.html")); } app.whenReady().then(() => { createWindow(); app.on("activate", () => { if (BrowserWindow.getAllWindows().length === 0) { createWindow(); } }); }); app.on("window-all-closed", () => { if (process.platform !== "darwin") { app.quit(); } });