chore: update to standard 12
This commit is contained in:
parent
9e85bdb02c
commit
558fff69e7
198 changed files with 4455 additions and 2940 deletions
|
@ -7,16 +7,16 @@ Process: [Main](../glossary.md#main-process)
|
|||
`Tray` is an [EventEmitter][event-emitter].
|
||||
|
||||
```javascript
|
||||
const {app, Menu, Tray} = require('electron')
|
||||
const { app, Menu, Tray } = require('electron')
|
||||
|
||||
let tray = null
|
||||
app.on('ready', () => {
|
||||
tray = 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' }
|
||||
])
|
||||
tray.setToolTip('This is my application.')
|
||||
tray.setContextMenu(contextMenu)
|
||||
|
@ -35,14 +35,14 @@ __Platform limitations:__
|
|||
you have to call `setContextMenu` again. For example:
|
||||
|
||||
```javascript
|
||||
const {app, Menu, Tray} = require('electron')
|
||||
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: 'Item1', type: 'radio' },
|
||||
{ label: 'Item2', type: 'radio' }
|
||||
])
|
||||
|
||||
// Make a change to the context menu
|
||||
|
@ -225,9 +225,9 @@ by toggling between `'never'` and `'always'` modes when the window visibility
|
|||
changes.
|
||||
|
||||
```javascript
|
||||
const {BrowserWindow, Tray} = require('electron')
|
||||
const { BrowserWindow, Tray } = require('electron')
|
||||
|
||||
const win = new BrowserWindow({width: 800, height: 600})
|
||||
const win = new BrowserWindow({ width: 800, height: 600 })
|
||||
const tray = new Tray('/path/to/my/icon')
|
||||
|
||||
tray.on('click', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue