diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/webview/badge.ts | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/webview/badge.ts b/src/webview/badge.ts index fb696723d..02bd3fb15 100644 --- a/src/webview/badge.ts +++ b/src/webview/badge.ts | |||
@@ -3,15 +3,6 @@ import { ipcRenderer } from 'electron'; | |||
3 | const debug = require('debug')('Ferdi:Plugin:BadgeHandler'); | 3 | const debug = require('debug')('Ferdi:Plugin:BadgeHandler'); |
4 | 4 | ||
5 | export class BadgeHandler { | 5 | export class BadgeHandler { |
6 | countCache: { direct: number; indirect: number }; | ||
7 | |||
8 | constructor() { | ||
9 | this.countCache = { | ||
10 | direct: 0, | ||
11 | indirect: 0, | ||
12 | }; | ||
13 | } | ||
14 | |||
15 | // TODO: Need to extract this into a utility class and reuse outside of the recipes | 6 | // TODO: Need to extract this into a utility class and reuse outside of the recipes |
16 | safeParseInt(text: string | number | undefined | null) { | 7 | safeParseInt(text: string | number | undefined | null) { |
17 | if (text === undefined || text === null) { | 8 | if (text === undefined || text === null) { |
@@ -35,16 +26,7 @@ export class BadgeHandler { | |||
35 | indirect: this.safeParseInt(indirect), | 26 | indirect: this.safeParseInt(indirect), |
36 | }; | 27 | }; |
37 | 28 | ||
38 | if ( | 29 | debug('Sending badge count to host: %j', count); |
39 | this.countCache.direct.toString() === count.direct.toString() && | ||
40 | this.countCache.indirect.toString() === count.indirect.toString() | ||
41 | ) { | ||
42 | return; | ||
43 | } | ||
44 | |||
45 | debug('Sending badge count to host', count); | ||
46 | ipcRenderer.sendToHost('message-counts', count); | 30 | ipcRenderer.sendToHost('message-counts', count); |
47 | |||
48 | Object.assign(this.countCache, count); | ||
49 | } | 31 | } |
50 | } | 32 | } |