I'm trying simplify going through code by creating a function which works as a class for the window. When doing so, it smacks the following in my face:
windows.Main.initialize is not a function
If you have any simplicity tips regarding this, please also let me know. It means a great deal that I make clean, readable, accessible code.
main.js
const electron = require('electron');
const { app, BrowserWindow, ipcMain } = require('electron');
const windows = require('./windowmanager');
function initialize() {
windows.Main.initialize(app);
}
// Initialize
app.on("ready", initialize);
windowmanager.js
const { app, BrowserWindow } = require('electron');
const path = require('path');
exports.__esModule = true;
function Main() {
function Main() { };
this.initialize = function (_app) {
Main.app = _app;
Main.window = new BrowserWindow({
frame: false,
minWidth: 800,
minHeight: 600,
height: 600,
width: 800,
show: true
});
Main.window.loadFile(path.join(__dirname, "../content/index.html"));
Main.window.on('closed', () => {
Main.app.quit();
});
};
return Main;
}
exports.Main = Main;