Merge pull request #7982 from kirly-af/kirly-af-tray-example-fix

[ci skip] Correct Linux limitation example
This commit is contained in:
Kevin Sawicki 2016-11-15 14:19:03 -08:00 committed by GitHub
commit b87d86e9d5

View file

@ -33,18 +33,22 @@ __Platform limitations:__
you have to call `setContextMenu` again. For example:
```javascript
const {Menu, Tray} = require('electron')
const appIcon = new Tray('/path/to/my/icon')
const {app, Menu, Tray} = require('electron')
let appIcon = null
app.on('ready', () => {
appIcon = new Tray('/path/to/my/icon')
const contextMenu = Menu.buildFromTemplate([
{label: 'Item1', type: 'radio'},
{label: 'Item2', type: 'radio'}
])
// Make a change to the context menu
contextMenu.items[2].checked = false
contextMenu.items[1].checked = false
// Call this again for Linux because we modified the context menu
appIcon.setContextMenu(contextMenu)
})
```
* On Windows it is recommended to use `ICO` icons to get best visual effects.