feat/getting-started-and-navbar
This commit is contained in:
parent
c503bc8a2b
commit
29320c475e
9 changed files with 555 additions and 75 deletions
39
main/main.js
Normal file
39
main/main.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
const { app, BrowserWindow } = require("electron");
|
||||
const serve = require("electron-serve");
|
||||
const path = require("path");
|
||||
|
||||
const appServe = app.isPackaged ? serve({
|
||||
directory: path.join(__dirname, "../out")
|
||||
}) : null;
|
||||
|
||||
const createWindow = () => {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, "preload.js")
|
||||
}
|
||||
});
|
||||
|
||||
if (app.isPackaged) {
|
||||
appServe(win).then(() => {
|
||||
win.loadURL("app://-");
|
||||
});
|
||||
} else {
|
||||
win.loadURL("http://localhost:3000");
|
||||
win.webContents.openDevTools();
|
||||
win.webContents.on("did-fail-load", (e, code, desc) => {
|
||||
win.webContents.reloadIgnoringCache();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
app.on("ready", () => {
|
||||
createWindow();
|
||||
});
|
||||
|
||||
app.on("window-all-closed", () => {
|
||||
if(process.platform !== "darwin"){
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue