I am trying to add close and minimize button on frameless window in Electron JS app. But its not working in anyhow. It's alwasy show "Cannot read property 'getCurrentWindow' of undefined" error. Here is my code:
const {remote} = require('electron');
document.getElementById('minimize').onclick = function() {
var window = remote.getCurrentWindow();
window.minimize();
}
document.getElementById('close').onclick = function() {
var window = remote.getCurrentWindow();
window.close();
}
I also add webPreferences: {nodeIntegration: true} in main.js.
win = new BrowserWindow({width: 990, height: 660, title: "Okkhor52 Tools", show: false, resizable: false, frame: false, webPreferences: {nodeIntegration: true}});
Please give me a sollution, I try to found this problem sollution in many place but i didn't get exact sollution.