Aller au contenu principal

Class: Dock

Class: Dock

Control your app in the macOS dock

Process: Main
This class is not exported from the 'electron' module. It is only available as a return value of other methods in the Electron API.

The following example shows how to bounce your icon on the dock.

const { app } = require('electron')
app.dock.bounce()

Méthodes d’instance

dock.bounce([type]) macOS

  • type String (optional) - Can be critical or informational. The default is informational

Returns Integer - an ID representing the request.

Lorsque la critical est passé, l’icône du dock rebondira jusqu'à ce que l’application redevienne active ou que la requête est annulée.

When informational is passed, the dock icon will bounce for one second. However, the request remains active until either the application becomes active or the request is canceled.

Nota Bene: This method can only be used while the app is not focused; when the app is focused it will return -1.

dock.cancelBounce(id) macOS

  • id Integer

Annule le rebond de l'id.

dock.downloadFinished(filePath) macOS

  • filePath String

Fait rebondir la pile de téléchargements si le chemin d'accès se trouve le dossier Téléchargements.

dock.setBadge(text) macOS

  • text String

Définit la chaîne de caractères à afficher dans la zone du badge du dock.

dock.getBadge() macOS

Retourne String - Le texte du badge du dock.

dock.hide() macOS

Masque l’icône du dock.

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

Sets the application's [dock menu][dock-menu].

dock.getMenu() macOS

Returns Menu | null - The application's [dock menu][dock-menu].

dock.setIcon(image) macOS

Définit l’image associée à l'icône du dock.