aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/slite/webview.js
blob: 1d6957ab214426ef1376fb9d6f06178083e9ca13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"use strict";

let getInnerInt = selector => {
  const element = document.querySelector(selector);
  return element && parseInt(element.innerText);
}

module.exports = Ferdi => {
  const getMessages = function getMessages() {
    let direct = (
      getInnerInt("#app button[data-test-id='notificationsCount']") || 0
    );

    Ferdi.setBadge(direct);
  };

  Ferdi.loop(getMessages);
};