Click event in contextmenu not triggered


#1

I have this code:

function createWindow () {
tray = new Tray(__dirname + '/icons/icon.ico')
const contextMenu = Menu.buildFromTemplate([
    {label: 'Exit', click () {
        app.quit()
    }}
])
tray.setToolTip('Open GitSpector')
tray.setContextMenu(contextMenu)
// ...`

However, the ‘click’ event is never triggered, which means, my application never quits! I use Windows 10 x64.
The function is only used in the ‘ready’ and ‘activate’ event.