aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/hackmd/webview.js
blob: 45cec034324171eebbdc300905076bb1d0845e95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const path = require('path');

module.exports = (Franz) => {
  const getMessages = function getMessages() {
    // get unread messages
    const count = document.querySelectorAll('.guilds-wrapper .badge').length;

    // set Franz badge
    Franz.setBadge(count);
  };

  // check for new messages every second and update Franz badge
  Franz.loop(getMessages);

  // Hide download message
  Franz.injectCSS(path.join(__dirname, 'service.css'));
};