aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/ntfy/webview.js
blob: 45b8d2d721da906d8538f6d0eb2a4f1851143f3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module.exports = (Ferdium) => {
  const getMessages = () => {
    let msgRaw = document.title.match(/\(\d*\)/);
    let messages = 0;

    if (msgRaw) {
      messages = Ferdium.safeParseInt(msgRaw[0].slice(1));
    }
    
    Ferdium.setBadge(messages, 0);
  }

  Ferdium.loop(getMessages);
};