Answer the question
In order to leave comments, you need to log in
How to close the Electron window?
Hello. I made the client using Electron.js. The created window has the following parameters:
width: 600,
height: 400,
frame: false,
resizable: false,
so I did mainWindow.setMenuBarVisibility(false) to turn off the menu
, I have a problem - I can't make a button to close the window. I need to save frame:false , which means I need to make my own button. I tried window.close , hide , app.quit but nothing helped. Is there a solution?
Answer the question
In order to leave comments, you need to log in
In theory, anywhere except the main file:
const { remote } = require('electron')
remote.getCurrentWindow().close()
win.on('closed', () => {
win = null
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question