aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/bip/webview.js
blob: 59c51f0e5f36c9d01d64eaca8c816cff4e714038 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
module.exports = Ferdium => {
  const getMessages = () => {
    const elements = document.querySelectorAll('.contact-list__message__unread-badge-counter');
    let count = 0;
    for (const element of elements) {
      count += Ferdium.safeParseInt(element.textContent);
    }
    Ferdium.setBadge(count, 0);
  };

  Ferdium.loop(getMessages);
};