aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/hubstaff/webview.js
blob: 408f78cdef5ceecf8d903921880dded04cc44600 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module.exports = (Ferdi) => {
  // TODO: If your hubstaff service has unread messages, uncomment these lines to implement the logic for updating the badges
  const getMessages = () => {
    // TODO: Insert your notification-finding code here
    let directMessages = 0;
    let indirectMessages = 0;
    const notificationContainers = document.querySelectorAll('.notifications-number');
    if (notificationContainers){
      directMessages = Ferdi.safeParseInt(notificationContainers[0].textContent);
      indirectMessages = Ferdi.safeParseInt(notificationContainers[1].textContent);
    }
    Ferdi.setBadge(directMessages, indirectMessages);
  };
  Ferdi.loop(getMessages);
};