Class: Dock
Class: Dock
Steuern Sie Ihre App im MacOS-Dock
Prozess: Haupt
Diese Klasse wird nicht aus dem 'electron'
-Modul exportiert. Es ist nur als Rückgabewert anderer Methoden in der Electron-API verfügbar.
Das folgende Beispiel zeigt, wie Sie Ihr Icon auf dem Dock springen lassen.
const { app } = require('electron')
app.dock.bounce()
Beispiel Methoden
dock.bounce([type])
macOS
type
string (optional) - Kanncritical
oderinformational
sein. Standard istinformational
Returns Integer
- Eine ID welche den Request repräsentiert.
Wenn critical
übergeben ist, wird das Dock-Symbol übersprungen, bis entweder die Anwendung aktiv wird oder die Anfrage abgebrochen wird.
Wenn informational
übergeben ist, wird das Dock-Symbol eine Sekunde lang springen. Die Anfrage bleibt jedoch so lange aktiv, bis entweder die Anwendung aktiv wird oder die Anfrage abgebrochen wird.
Hinweis: Diese Methode kann nur verwendet werden, wenn die Anwendung nicht fokussiert ist. Wenn die Anwendung fokussiert ist, wird -1 zurückgegeben.
dock.cancelBounce(id)
macOS
id
Integer
Cancel the bounce of id
.
dock.downloadFinished(filePath)
macOS
filePath
string
Bounces the Downloads stack if the filePath is inside the Downloads folder.
dock.setBadge(text)
macOS
text
string
Sets the string to be displayed in the dock’s badging area.
dock.getBadge()
macOS
Returns string
- The badge string of the dock.
dock.hide()
macOS
Versteckt das dock icon.
dock.show()
macOS
Returns Promise<void>
- Resolves when the dock icon is shown.
dock.isVisible()
macOS
Returns boolean
- Whether the dock icon is visible.
dock.setMenu(menu)
macOS
menu
Menu
Legt das App Dock-Menü fest.
dock.getMenu()
macOS
Returns Menu | null
- The application's dock menu.
dock.setIcon(image)
macOS
image
(NativeImage | string)
Setzt das image
welches als Dock Icon verwendet werden soll.