Clean up duplicate code in Electron options

This commit is contained in:
Olexandr Savchuk 2016-12-02 21:09:16 +01:00
parent a08fa721cf
commit c8d5a5319e

View File

@ -18,13 +18,29 @@ const BrowserWindow = electron.BrowserWindow;
let mainWindow;
function createWindow() {
// Create the browser window.
if (config.kioskmode) {
mainWindow = new BrowserWindow({width: 800, height: 600, x: 0, y: 0, kiosk:true, darkTheme: true, webPreferences: {nodeIntegration: false, zoomFactor: config.zoom}});
} else {
mainWindow = new BrowserWindow({width: 800, height: 600, x: 0, y: 0, fullscreen: true, autoHideMenuBar: true, darkTheme: true, webPreferences: {nodeIntegration: false, zoomFactor: config.zoom}});
var electronOptions = {
width: 800,
height: 600,
x: 0,
y: 0,
darkTheme: true,
webPreferences: {
nodeIntegration: false,
zoomFactor: config.zoom
}
}
if (config.kioskmode) {
electronOptions.kiosk = true;
} else {
electronOptions.fullscreen = true;
electronOptions.autoHideMenuBar = true;
}
// Create the browser window.
mainWindow = new BrowserWindow(electronOptions);
// and load the index.html of the app.
//mainWindow.loadURL('file://' + __dirname + '../../index.html');
mainWindow.loadURL("http://localhost:" + config.port);