📝 Fix code style issue
* Change `var` to `let`. * Change `function() {}` to `() => {}`. * Use shorthand function syntax on object notation. * Remove spaces between object notation brackets. * Small fixes.
This commit is contained in:
parent
139a4f984a
commit
f1b184ef78
23 changed files with 64 additions and 67 deletions
|
@ -3,19 +3,16 @@
|
|||
> Add icons and context menus to the system's notification area.
|
||||
|
||||
```javascript
|
||||
const electron = require('electron');
|
||||
const app = electron.app;
|
||||
const Menu = electron.Menu;
|
||||
const Tray = electron.Tray;
|
||||
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' },
|
||||
{ label: 'Item3', type: 'radio', checked: true },
|
||||
{ label: 'Item4', type: 'radio' }
|
||||
{label: 'Item1', type: 'radio'},
|
||||
{label: 'Item2', type: 'radio'},
|
||||
{label: 'Item3', type: 'radio', checked: true},
|
||||
{label: 'Item4', type: 'radio'}
|
||||
]);
|
||||
appIcon.setToolTip('This is my application.');
|
||||
appIcon.setContextMenu(contextMenu);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue