36 lines
1008 B
JavaScript
36 lines
1008 B
JavaScript
const { BrowserWindow, app, net, dialog } = require("electron")
|
|
const path = require("node:path")
|
|
let launcherWindow
|
|
|
|
async function createLauncherWindow() {
|
|
if (net.isOnline()) {
|
|
launcherWindow = new BrowserWindow({
|
|
frame: false,
|
|
width: 900,
|
|
height: 600,
|
|
minWidth: 900,
|
|
minHeight: 600,
|
|
titleBarStyle: "hidden",
|
|
autoHideMenuBar: true,
|
|
roundedCorners: false,
|
|
webPreferences: {
|
|
nodeIntegration: false,
|
|
contextIsolation: true,
|
|
preload: path.join(__dirname, "app", "index.html")
|
|
}
|
|
})
|
|
} else {
|
|
dialog.showErrorBox("Le launcher requiert une connexion internet.")
|
|
}
|
|
}
|
|
|
|
app.whenReady().then(() => {
|
|
createLauncherWindow()
|
|
app.on("activate", async () => {
|
|
if (BrowserWindow.getAllWindows().length === 0) await createLauncherWindow()
|
|
})
|
|
})
|
|
|
|
app.on("window-all-closed", () => {
|
|
app.quit()
|
|
}) |