電子托盤應用程式
在托盤欄中新增圖示
let tray = null;
let mainWindow = null;
let user = null;
app.on('ready', () => {
/**
* Tray related code.
*/
const iconName = 'icon.png';
const iconPath = path.join(__dirname, iconName);
tray = new Tray(iconPath);
tray.setToolTip('AMP Notifier App');
const contextMenu = Menu.buildFromTemplate([{
label: 'Quit',
click: destroyApp
}]);
tray.setContextMenu(contextMenu);
tray.on('click', () => {
app.quit();
});
});