render.js
const remote = require('electron').remote;
const wnd = remote.getCurrentWindow();
document.addEventListener('DOMContentLoaded', () => {
console.log('cmn.js loaded')
let btn_min = document.querySelector('.btn-min');
let btn_close = document.querySelector('.btn-close');
document.querySelector('.btn-min').addEventListener('click', () => {
btn_min.addEventListener('click', () => {
wnd.minimize();
});
});
btn_close.addEventListener('click', () => {
wnd.close();
});
});```
main.js
```py
const path = require('path');
const url = require('url');
const { app, BrowserWindow, ipcMain, webContents } = require('electron');
let win;
function createWindow() {
win = new BrowserWindow({
width: 1450,
height: 678,
minHeight: 678,
minWidth: 1450,
maxHeight: 678,
maxWidth: 1450,
icon: __dirname + "/img/icon.png",
frame: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
}
});
win.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}));
//win,webContents.openDevtools();
};
app.on('window-all-closed', () => {
app.quit();
});
app.on('ready', createWindow);```