Number of products
Whether to flash the badge for a moment first
Resolves once the badge is set; flashing continues after that
await showDropBadge(2, true);
export async function showDropBadge(count: number, shouldFlash: boolean): Promise<void> {
const { color, flashColor, flashIntervalMs, flashSeconds } = priceAlertsConfig.badge;
const text = dropBadgeText(count);
// Setting the text blanks it first, which would be a visible blink.
if ((await chrome.action.getBadgeText({})) !== text) await BadgeAnimator.setText(text);
await BadgeAnimator.setColor(undefined, color);
if (shouldFlash) {
void BadgeAnimator.flash([color, flashColor], flashIntervalMs, flashSeconds * 1000);
}
}
Shows the number of products with an unseen drop on the badge.