Dock
Allows controlling application icon in the Dock on macOS.
import { dock } from '@mobrowser/api';
Example
import { dock } from '@mobrowser/api';
dock.setBadgeText('3')
console.log(dock.isVisible)
Properties
isVisible
readonly isVisible: boolean;
Whether the application icon is visible in the Dock.
menu
readonly menu: Menu | null;
The currently assigned custom Dock menu, or null if none is set.
Methods
show()
show(): void;
Shows the application icon in the Dock.
hide()
hide(): void;
Hides the application icon in the Dock.
setBadgeText()
setBadgeText(text: string): void;
Sets the badge text of the application icon in the Dock.
If you don’t see the badge text after calling this method, then go to System Preferences > Notifications and make sure your app is enabled for notifications and the “Badge application icon” option is enabled.
| Parameter | Type | Description |
|---|---|---|
text | string | The badge text to display. Use an empty string to clear the badge. |
getBadgeText()
getBadgeText(): string;
Gets the badge text of the application icon in the Dock.
setMenu()
setMenu(menu: Menu | null): void;
Sets the Dock menu shown when the user right-clicks or long-presses the app icon in the Dock.
Pass null to remove the Dock menu.