1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-19 14:25:13 +03:00
inav-configurator/main.js
Andi Kanzler f24ccfc637 Init
2024-02-10 18:08:17 -03:00

64 lines
No EOL
1.6 KiB
JavaScript

const { app, BrowserWindow } = require('electron');
const windowStateKeeper = require('electron-window-state');
const Store = require('electron-store');
Store.initRenderer();
require('@electron/remote/main').initialize();
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require('electron-squirrel-startup')) {
app.quit();
}
let mainWindow = null;
app.on('ready', () => {
let mainWindowState = windowStateKeeper({
defaultWidth: 800,
defaultHeight: 600
});
mainWindow = new BrowserWindow({
x: mainWindowState.x,
y: mainWindowState.y,
width: mainWindowState.width,
height: mainWindowState.height,
autoHideMenuBar: true,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
webSecurity: false
},
});
app.commandLine.appendSwitch('disable-features', 'OutOfBlinkCors')
require("@electron/remote/main").enable(mainWindow.webContents);
mainWindow.removeMenu();
mainWindow.setMinimumSize(800, 600);
mainWindow.loadFile('index.html');
mainWindowState.manage(mainWindow);
// Open the DevTools.
if (process.env.NODE_ENV === 'development') {
mainWindow.webContents.openDevTools();
}
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
console.log("We're closing...");
});
app.on('activate', () => {
// On OS X 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();
}
});