index.js
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
resizable: false,
frame: false,
icon: path.join(__dirname, 'icon.png'),
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
// devTools: false,
nodeIntegration: true,
contextIsolation: false,
},
});
script
const minimizeButton = document.getElementById('minimize');
const closeButton = document.getElementById('close');
minimizeButton.addEventListener('click', () => {
window.hide();
});
closeButton.addEventListener('click', () => {
window.close();
});
window.close(); works fine, but when calling window.hide(); it throws TypeError: window.hide is not a function. What to do?
on
nodeIntegration: true,
contextIsolation: false,