Appearance
Badge Module
Warning
This module is currently supported only on macOS.
The badge module allows you to control the application’s Dock badge — the small red indicator typically used to display unread counts or notifications.
This feature is available only on macOS. On Windows and Linux, this module will be undefined and should not be accessed without checking availability.
Overview
Use the Badge Interface to display or clear numeric badges on the app’s Dock icon.
Typical use cases include showing the number of unread messages, pending tasks, or notifications.
Methods
| Method | Description |
|---|---|
set(count: number) | Sets the numeric badge on the Dock icon to the specified value. Must be a non-negative integer. |
clear() | Clears the badge from the Dock icon, restoring it to its default state. |
Example
javascript
// Always verify that the badge API is available before use
if (Bubbledesk.badge) {
// Set a badge count of 5
await Bubbledesk.badge.set(5);
// Clear the badge after a delay
setTimeout(async () => {
await Bubbledesk.badge.clear();
}, 5000);
} else {
console.log("Badge API is not available on this platform.");
}Notes
Warning
This module is currently supported only on macOS.