Open in browser instead of electron window
This commit is contained in:
parent
3344cb8550
commit
867f019d82
|
@ -12,7 +12,6 @@ setTimeout(() => {
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV !== "production") {
|
||||||
const chokidar = require("chokidar");
|
const chokidar = require("chokidar");
|
||||||
const watcher = chokidar.watch("./lib");
|
const watcher = chokidar.watch("./lib");
|
||||||
const { BrowserWindow } = require("electron");
|
|
||||||
|
|
||||||
watcher.on("ready", () => {
|
watcher.on("ready", () => {
|
||||||
watcher.on("all", () => {
|
watcher.on("all", () => {
|
||||||
|
@ -22,7 +21,6 @@ if (process.env.NODE_ENV !== "production") {
|
||||||
});
|
});
|
||||||
if (server) server.close();
|
if (server) server.close();
|
||||||
server = require("./lib/express");
|
server = require("./lib/express");
|
||||||
BrowserWindow.getAllWindows()[0].reload();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +1,6 @@
|
||||||
const { app, BrowserWindow } = require("electron");
|
const { app, shell } = require("electron");
|
||||||
|
|
||||||
const createWindow = () => {
|
app.whenReady().then(() => {
|
||||||
// Create the browser window.
|
let port = process.env.EXPRESS_PORT || 3000;
|
||||||
let win = new BrowserWindow({
|
shell.openExternal(`http://localhost:${port}`);
|
||||||
width: 800,
|
|
||||||
height: 600,
|
|
||||||
webPreferences: {
|
|
||||||
nodeIntegration: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
win.loadURL(`http://localhost:${process.env.EXPRESS_PORT || 3000}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
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.
|
|
||||||
if (BrowserWindow.getAllWindows().length == 0) {
|
|
||||||
createWindow();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue