Merge pull request #408 from FWeinb/patch-1
Update `tray` example to wait for app.on('ready')
This commit is contained in:
commit
6493bc4c8c
1 changed files with 14 additions and 9 deletions
|
@ -4,18 +4,23 @@ A `Tray` represents an icon in operating system's notification area, it is
|
||||||
usually attached with a context menu.
|
usually attached with a context menu.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
var app = require('app');
|
||||||
var Menu = require('menu');
|
var Menu = require('menu');
|
||||||
var Tray = require('tray');
|
var Tray = require('tray');
|
||||||
|
|
||||||
var appIcon = new Tray('/path/to/my/icon');
|
var appIcon = null;
|
||||||
var contextMenu = Menu.buildFromTemplate([
|
app.on('ready', function(){
|
||||||
{ label: 'Item1', type: 'radio' },
|
appIcon = new Tray('/path/to/my/icon');
|
||||||
{ label: 'Item2', type: 'radio' },
|
var contextMenu = Menu.buildFromTemplate([
|
||||||
{ label: 'Item3', type: 'radio', clicked: true },
|
{ label: 'Item1', type: 'radio' },
|
||||||
{ label: 'Item4', type: 'radio' },
|
{ label: 'Item2', type: 'radio' },
|
||||||
]);
|
{ label: 'Item3', type: 'radio', clicked: true },
|
||||||
appIcon.setToolTip('This is my application.');
|
{ label: 'Item4', type: 'radio' },
|
||||||
appIcon.setContextMenu(contextMenu);
|
]);
|
||||||
|
appIcon.setToolTip('This is my application.');
|
||||||
|
appIcon.setContextMenu(contextMenu);
|
||||||
|
});
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
__Platform limitations:__
|
__Platform limitations:__
|
||||||
|
|
Loading…
Reference in a new issue