I have created an electron app with a tray Icon. When I right click the tray icon I show a menu with 4 options:
- Minimize
- Maximize
- Restart
- Exit
Here is the code that creates the tray Icon:
trayIcon = new Tray('icons/foo.png');
const trayMenuTemplate = [{
label: 'Maximize',
click:(_,window)=>{
window.maximize();
}
}, {
label: 'Minimize',
click:(_,window)=>{
window.minimize();
}
}, {
label: 'Restart'
}, {
type: 'separator'
}, {
label: 'Quit',
role: 'quit'
}];
However I have a problem.When I click Minimize and then I click Maximize I get an error saying Cannnot read property maximize of null
Any ideas?Thanks