Main process source code index.js:
const {app, BrowserWindow, ipcMain} = require('electron')
let win = null
app.on('ready', () => {
win = new BrowserWindow()
win.loadURL(`file://${__dirname}/index.html`)
win.webContents.openDevTools()
win.on('closed', () => {
win = null
...