aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/producthunt/webview.js
blob: 7f6c74b3df86a48d3f7fb33e59c894912e5ed2fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
module.exports = Ferdi => {
  const notificationsSelector = document.querySelector(
    '[class*=header_] [class*=content_] [class*=actions_] [class*=notificationsButton_]',
  );

  const getMessages = () => {
    if (notificationsSelector) {
      Ferdi.setBadge(notificationsSelector.textContent);
    }
  };

  Ferdi.loop(getMessages);
};