const config = require('../config');
const { BrowserWindow } = require('electron');
const window = {};

window.new = function (file, width, height) {
    // Default values
    width = width ? width : config.window.width;
    height = height ? height : config.window.height;
    // New window
    const win = new BrowserWindow ({
        width: width,
        height: height,
        webPreferences: {
            nodeIntegration: true
        }
    });
    win.loadFile(file);
    return win;
}

window.simple = function (file, width, height) {
    // Default values
    width = width ? width : config.window.width;
    height = height ? height : config.window.height;
    // New window
    const win = new BrowserWindow ({
        width: width,
        height: height,
        webPreferences: {
            nodeIntegration: false
        }
    });
    win.loadFile(file);
    return win;
}

module.exports = window;