freechat/freechat-client/main.js
shockrah 09f27dd554 ! More restructuring changes
The client is basically gonna get served from a localhost server via electron. It's a little weird but it has to do for now, also fuck mobile
2020-12-06 14:45:06 -08:00

44 lines
808 B
JavaScript

const { app, BrowserWindow } = require('electron')
const path = require('path')
let win;
function createWin() {
let win = new BrowserWindow({
width: 800,
height: 600,
minWidth: 640,
minHeight: 480,
webPreferences: {
nodeIntegration: true,
preload: path.join(__dirname + 'preload.js')
},
autoHideMenuBar: true,
})
win.loadFile('pages/index.html');
if(process.platform !== 'darwin') {
win.removeMenu();
}
win.on('closed', () => {
win = null
});
}
app.on('ready', createWin);
// on mac just because the windows are closed doesn't mean the application is too
// ! The toolbar keeps things alive against its will
app.on('window-all-closed', () => {
if(process.platform !== 'darwin') {
app.quit()
}
});
app.on('activate', () => {
if(win === null) {
createWin();
}
});