This repository has been archived on 2021-06-30. You can view files and clone it, but cannot push or open issues or pull requests.
melodii/main.js

29 lines
689 B
JavaScript
Raw Normal View History

2019-02-09 01:34:04 +00:00
require('dotenv').config();
const { app, BrowserWindow } = require('electron');
let win;
function createWindow() {
win = new BrowserWindow({ width: 800, height: 600, frame: false, webPreferences: { webSecurity: false } }); //TODO: Please find a better solution for the love of god.
if (process.env.NODE_ENV) win.loadURL(`http://localhost:${process.env.PORT}`);
else win.loadFile('./build/index.html');
win.webContents.openDevTools();
win.on('closed', () => {
win = null;
});
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});
app.on('activate', () => {
if (win === null) createWindow();
});