docs: Tray.getBounds()
This commit is contained in:
parent
324153d394
commit
11f242a241
1 changed files with 16 additions and 6 deletions
|
@ -3,20 +3,20 @@
|
||||||
> Add icons and context menus to the system's notification area.
|
> Add icons and context menus to the system's notification area.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const {app, Menu, Tray} = require('electron');
|
const {app, Menu, Tray} = require('electron')
|
||||||
|
|
||||||
let appIcon = null;
|
let appIcon = null
|
||||||
app.on('ready', () => {
|
app.on('ready', () => {
|
||||||
appIcon = new Tray('/path/to/my/icon');
|
appIcon = new Tray('/path/to/my/icon')
|
||||||
const contextMenu = Menu.buildFromTemplate([
|
const contextMenu = Menu.buildFromTemplate([
|
||||||
{label: 'Item1', type: 'radio'},
|
{label: 'Item1', type: 'radio'},
|
||||||
{label: 'Item2', type: 'radio'},
|
{label: 'Item2', type: 'radio'},
|
||||||
{label: 'Item3', type: 'radio', checked: true},
|
{label: 'Item3', type: 'radio', checked: true},
|
||||||
{label: 'Item4', type: 'radio'}
|
{label: 'Item4', type: 'radio'}
|
||||||
]);
|
]);
|
||||||
appIcon.setToolTip('This is my application.');
|
appIcon.setToolTip('This is my application.')
|
||||||
appIcon.setContextMenu(contextMenu);
|
appIcon.setContextMenu(contextMenu)
|
||||||
});
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
__Platform limitations:__
|
__Platform limitations:__
|
||||||
|
@ -208,4 +208,14 @@ The `position` is only available on Windows, and it is (0, 0) by default.
|
||||||
|
|
||||||
Sets the context menu for this icon.
|
Sets the context menu for this icon.
|
||||||
|
|
||||||
|
### `Tray.getBounds()` _macOS_ _Windows_
|
||||||
|
|
||||||
|
Returns the `bounds` of this tray icon as `Object`.
|
||||||
|
|
||||||
|
* `bounds` Object
|
||||||
|
* `x` Integer
|
||||||
|
* `y` Integer
|
||||||
|
* `width` Integer
|
||||||
|
* `height` Integer
|
||||||
|
|
||||||
[event-emitter]: http://nodejs.org/api/events.html#events_class_events_eventemitter
|
[event-emitter]: http://nodejs.org/api/events.html#events_class_events_eventemitter
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue