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

const path = require('path');

module.exports = Franz => {
  const getMessages = () => {
    const totalNotifications = document.querySelectorAll('#notificationList > .notification').length;
    const hasUnread = document.querySelectorAll('#notificationsButton.hasUnread').length > 0;

    // set Franz badge
    if (hasUnread) {
      Franz.setBadge(totalNotifications);
    }
  };

  Franz.loop(getMessages);
};