forked from meqabayt/franz-recipe-asana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webview.js
23 lines (18 loc) · 2.46 KB
/
webview.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'use strict';
const path = require('path');
module.exports = Franz => {
const getMessages = function getMessages() {
const hasNotification = document.querySelectorAll(".SidebarTopNavLinks-notificationsButton--hasNewNotifications");
let count = 0;
if (hasNotification.length > 0) {
count +=1;
}
// set Franz badge
Franz.setBadge(count);
};
// inject franz.css stylesheet
Franz.injectCSS(path.join(__dirname, 'service.css'));
// check for new messages every second and update Franz badge
Franz.loop(getMessages);
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndoYXRzYXBwL3dlYnZpZXcuanMiXSwibmFtZXMiOlsicGF0aCIsInJlcXVpcmUiLCJtb2R1bGUiLCJleHBvcnRzIiwiRnJhbnoiLCJnZXRNZXNzYWdlcyIsImVsZW1lbnRzIiwiZG9jdW1lbnQiLCJxdWVyeVNlbGVjdG9yQWxsIiwiY291bnQiLCJpIiwibGVuZ3RoIiwic2V0QmFkZ2UiLCJpbmplY3RDU1MiLCJqb2luIiwiX19kaXJuYW1lIiwibG9vcCJdLCJtYXBwaW5ncyI6Ijs7QUFBQSxNQUFNQSxPQUFPQyxRQUFRLE1BQVIsQ0FBYjs7QUFFQUMsT0FBT0MsT0FBUCxHQUFrQkMsS0FBRCxJQUFXO0FBQzFCLFFBQU1DLGNBQWMsU0FBU0EsV0FBVCxHQUF1QjtBQUN6QyxVQUFNQyxXQUFXQyxTQUFTQyxnQkFBVCxDQUEwQixTQUExQixDQUFqQjtBQUNBLFFBQUlDLFFBQVEsQ0FBWjs7QUFFQSxTQUFLLElBQUlDLElBQUksQ0FBYixFQUFnQkEsSUFBSUosU0FBU0ssTUFBN0IsRUFBcUNELEtBQUssQ0FBMUMsRUFBNkM7QUFDM0MsVUFBSUosU0FBU0ksQ0FBVCxF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