forked from tsai/budibase
24 changed files with 93 additions and 111 deletions
@ -1,47 +1,46 @@ |
|||||
const { app, BrowserWindow } = require("electron"); |
const { app, BrowserWindow } = require("electron") |
||||
const { join } = require("path"); |
const { join } = require("path") |
||||
const { homedir } = require("os"); |
const { homedir } = require("os") |
||||
const isDev = require("electron-is-dev"); |
const isDev = require("electron-is-dev") |
||||
const { autoUpdater } = require("electron-updater"); |
const { autoUpdater } = require("electron-updater") |
||||
const unhandled = require("electron-unhandled"); |
const unhandled = require("electron-unhandled") |
||||
|
|
||||
require("dotenv").config({ path: join(homedir(), ".budibase", ".env") }); |
require("dotenv").config({ path: join(homedir(), ".budibase", ".env") }) |
||||
|
|
||||
if (isDev) { |
if (isDev) { |
||||
unhandled({ |
unhandled({ |
||||
showDialog: true |
showDialog: true, |
||||
}); |
}) |
||||
} |
} |
||||
|
|
||||
const APP_URL = "http://localhost:4001"; |
const APP_URL = "http://localhost:4001" |
||||
const APP_TITLE = "Budibase Builder"; |
const APP_TITLE = "Budibase Builder" |
||||
|
|
||||
let win |
let win |
||||
|
|
||||
function createWindow() { |
function createWindow() { |
||||
app.server = require("./app"); |
app.server = require("./app") |
||||
win = new BrowserWindow({ width: 1920, height: 1080 }); |
win = new BrowserWindow({ width: 1920, height: 1080 }) |
||||
win.setTitle(APP_TITLE); |
win.setTitle(APP_TITLE) |
||||
win.loadURL(APP_URL); |
win.loadURL(APP_URL) |
||||
if (isDev) { |
if (isDev) { |
||||
win.webContents.openDevTools(); |
win.webContents.openDevTools() |
||||
} else { |
} else { |
||||
autoUpdater.checkForUpdatesAndNotify(); |
autoUpdater.checkForUpdatesAndNotify() |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
app.whenReady().then(createWindow) |
app.whenReady().then(createWindow) |
||||
|
|
||||
|
|
||||
// Quit when all windows are closed.
|
// Quit when all windows are closed.
|
||||
app.on("window-all-closed", () => { |
app.on("window-all-closed", () => { |
||||
// On macOS it is common for applications and their menu bar
|
// On macOS it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
// to stay active until the user quits explicitly with Cmd + Q
|
||||
if (process.platform !== "darwin") app.quit(); |
if (process.platform !== "darwin") app.quit() |
||||
}); |
}) |
||||
|
|
||||
app.on("activate", () => { |
app.on("activate", () => { |
||||
// On macOS it's common to re-create a window in the app when the
|
// 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.
|
// dock icon is clicked and there are no other windows open.
|
||||
if (win === null) createWindow(); |
if (win === null) createWindow() |
||||
}); |
}) |
||||
|
|||||
Loading…
Reference in new issue