Merge pull request #408 from FWeinb/patch-1

Update `tray` example to wait for app.on('ready')
This commit is contained in:
Cheng Zhao 2014-06-18 09:07:27 +08:00
commit 6493bc4c8c

View file

@ -4,10 +4,13 @@ A `Tray` represents an icon in operating system's notification area, it is
usually attached with a context menu.
```javascript
var app = require('app');
var Menu = require('menu');
var Tray = require('tray');
var appIcon = new Tray('/path/to/my/icon');
var appIcon = null;
app.on('ready', function(){
appIcon = new Tray('/path/to/my/icon');
var contextMenu = Menu.buildFromTemplate([
{ label: 'Item1', type: 'radio' },
{ label: 'Item2', type: 'radio' },
@ -16,6 +19,8 @@ var contextMenu = Menu.buildFromTemplate([
]);
appIcon.setToolTip('This is my application.');
appIcon.setContextMenu(contextMenu);
});
```
__Platform limitations:__