docs: use optional chaining for app.dock
(#46140)
docs: use optional chaining for app.dock Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Niklas Wenzel <dev@nikwen.de>
This commit is contained in:
parent
29ead1bc25
commit
1424da9131
3 changed files with 3 additions and 7 deletions
|
@ -9,7 +9,7 @@ The following example shows how to bounce your icon on the dock.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const { app } = require('electron')
|
const { app } = require('electron')
|
||||||
app.dock.bounce()
|
app.dock?.bounce()
|
||||||
```
|
```
|
||||||
|
|
||||||
### Instance Methods
|
### Instance Methods
|
||||||
|
|
|
@ -24,9 +24,7 @@ const dockMenu = Menu.buildFromTemplate([
|
||||||
])
|
])
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
if (process.platform === 'darwin') {
|
app.dock?.setMenu(dockMenu)
|
||||||
app.dock.setMenu(dockMenu)
|
|
||||||
}
|
|
||||||
}).then(createWindow)
|
}).then(createWindow)
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
|
|
|
@ -50,9 +50,7 @@ const dockMenu = Menu.buildFromTemplate([
|
||||||
])
|
])
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
if (process.platform === 'darwin') {
|
app.dock?.setMenu(dockMenu)
|
||||||
app.dock.setMenu(dockMenu)
|
|
||||||
}
|
|
||||||
}).then(createWindow)
|
}).then(createWindow)
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue