diff options
Diffstat (limited to 'recipes/stackoverflow-chat/webview.js')
-rw-r--r-- | recipes/stackoverflow-chat/webview.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/recipes/stackoverflow-chat/webview.js b/recipes/stackoverflow-chat/webview.js index 044c773..cf487b5 100644 --- a/recipes/stackoverflow-chat/webview.js +++ b/recipes/stackoverflow-chat/webview.js | |||
@@ -3,12 +3,15 @@ var _path = _interopRequireDefault(require('path')); | |||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
4 | 4 | ||
5 | module.exports = Ferdi => { | 5 | module.exports = Ferdi => { |
6 | // TODO: If your stackoverflow-chat service has unread messages, uncomment these lines to implement the logic for updating the badges | 6 | const getMessages = () => { |
7 | // const getMessages = () => { | 7 | const unreadSpan = document.querySelector('span.flag-count.message-count.unread-count'); |
8 | // // TODO: Insert your notification-finding code here | 8 | let directCount = 0; |
9 | // Ferdi.setBadge(0, 0); | 9 | if (unreadSpan) { |
10 | // }; | 10 | directCount = Ferdi.safeParseInt(unreadSpan.innerText); |
11 | // Ferdi.loop(getMessages); | 11 | } |
12 | Ferdi.setBadge(directCount); | ||
13 | }; | ||
14 | Ferdi.loop(getMessages); | ||
12 | 15 | ||
13 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); | 16 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); |
14 | }; | 17 | }; |