36 lines
654 B
JavaScript
36 lines
654 B
JavaScript
const { app, BrowserWindow } = require('electron')
|
|
|
|
let win;
|
|
|
|
function createWin() {
|
|
let win = new BrowserWindow({
|
|
width: 800,
|
|
height: 600,
|
|
minWidth: 640,
|
|
minHeight: 480,
|
|
webPreferences: {
|
|
nodeIntegration: true
|
|
}
|
|
})
|
|
win.loadFile('./src//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
|
|
app.on('window-all-closed', () => {
|
|
if(process.platform !== 'darwin') {
|
|
app.quit()
|
|
}
|
|
});
|
|
|
|
app.on('activate', () => {
|
|
if(win === null) {
|
|
createWin();
|
|
}
|
|
});
|