I was just developing an electron app and was quickly making a close button for the app. Here is some of the code:
HTML for button
<button id="close-btn">close app</button>
Javascript (frontend)
const electron = require('electron').remote
const closeBtn = document.getElementById('close-btn')
closeBtn.addEventListener('click', function (e) {
var window = electron.getCurrentWindow();
window.close();
})
And for some reason when I tested the button out, it didn't work! And my webPrefrences
had nodeIntegration
set to true and contextIsolation
set to false. I checked if I linked the JS file correctly with an alert on a click event and it worked just fine. \
Anyone know what's going on and how to fix it?