I want someone to help me out in this problem. I want to know a method which hides my application from the taskbar. I want to make an app that works in the background.
I am new to the electron, therefore I hadn’t known anything about it. So, I hadn’t actually tried anything out.
Advertisement
Answer
you can prevent it before close and hide window.
JavaScript
x
16
16
1
const {app} = require('electron');
2
const winConfig = {
3
minWidth: 420,
4
minHeight: 530,
5
width: 400,
6
height: 530
7
}
8
app.on('ready', () => {
9
win = new BrowserWindow(winConfig);
10
win.on('close', function (event){
11
event.preventDefault()
12
win.hide()
13
return false
14
})
15
})
16
with this code it prevent to close window and for quit app you can call app.quit()
.
if you use this and send your app to background I recommend you to use tray module for restore and have access your app again.