initial app
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
const { app, BrowserWindow } = require('electron/main')
|
||||
const path = require('node:path')
|
||||
const fs = require("fs");
|
||||
|
||||
|
||||
let url = 'https://www.tooloop.de';
|
||||
let config;
|
||||
let mainWindow;
|
||||
|
||||
|
||||
function loadConfig() {
|
||||
fs.readFile(path.join(__dirname, "config.json"), "utf8", (error, data) => {
|
||||
if (error) {
|
||||
console.log(error);
|
||||
return;
|
||||
}
|
||||
config = JSON.parse(data);
|
||||
console.log(config);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function createWindow() {
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js'),
|
||||
nodeIntegration: true,
|
||||
webSecurity: false,
|
||||
},
|
||||
show: false,
|
||||
autoHideMenuBar: true
|
||||
});
|
||||
|
||||
mainWindow.loadFile('index.html');
|
||||
// mainWindow.loadURL(url);
|
||||
|
||||
mainWindow.on("closed", function () {
|
||||
mainWindow = null;
|
||||
});
|
||||
|
||||
mainWindow.once("ready-to-show", () => {
|
||||
mainWindow.setKiosk(true);
|
||||
mainWindow.show();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
loadConfig();
|
||||
createWindow();
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user