FreeDATA/gui_vue/dist-electron/main.js
2023-09-02 13:37:03 +02:00

1 line
747 B
JavaScript

"use strict";const o=require("electron"),n=require("node:path");process.env.DIST=n.join(__dirname,"../dist");process.env.PUBLIC=o.app.isPackaged?process.env.DIST:n.join(process.env.DIST,"../public");let e;const s=process.env.VITE_DEV_SERVER_URL;function t(){e=new o.BrowserWindow({icon:n.join(process.env.PUBLIC,"electron-vite.svg"),webPreferences:{preload:n.join(__dirname,"preload-main.js"),backgroundThrottle:!1,nodeIntegration:!0,contextIsolation:!1,enableRemoteModule:!1,sandbox:!1}}),e.webContents.on("did-finish-load",()=>{e==null||e.webContents.send("main-process-message",new Date().toLocaleString())}),s?e.loadURL(s):e.loadFile(n.join(process.env.DIST,"index.html"))}o.app.on("window-all-closed",()=>{e=null});o.app.whenReady().then(t);