badge ⇒ WeavyWidget.plugins.badge

Plugin for displaying badges/dots

Kind: global mixin
Emits: event:badge
Properties
NameType
.setBadge()setBadge

widget.setBadge(element, count)

Method for adding a badge to a widget element. If the count is changed a pulsating dot is displayed.

Kind: instance method of badge
ParamTypeDescription
elementElement

The element which badge classes and properties should be applied to.

countint

The count of the badge. The badge is removed if count is 0.


Events

"badge" ⇒ Object

Triggers when the number of unread conversations or notifications change.

Kind: event emitted by badge
Category: events
Properties
NameTypeDescription
conversationsint

Number of unread conversations

notificationsint

Number of unread notifications

totalint

The total number of unread conversations and notifications.

Example
widget.on("badge", function (e, data) {
    widget.log("New notifications count", data.notifications);
    widget.log("Unread conversations count", data.conversations);
});