aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/badge.ts
diff options
context:
space:
mode:
authorLibravatar Vijay A <vraravam@users.noreply.github.com>2021-10-27 07:25:26 +0530
committerLibravatar Vijay A <vraravam@users.noreply.github.com>2021-10-27 07:25:26 +0530
commit477bdd76a7405ff10a5cfabdec00ee9ae02f2698 (patch)
treebfa8cfb70e6852b9f535ccfd9b05712269a70dc1 /src/webview/badge.ts
parentBumped up ferdi beta version to '5.6.3-beta.2' (diff)
parent5.6.3-nightly.44 [skip ci] (diff)
downloadferdium-app-477bdd76a7405ff10a5cfabdec00ee9ae02f2698.tar.gz
ferdium-app-477bdd76a7405ff10a5cfabdec00ee9ae02f2698.tar.zst
ferdium-app-477bdd76a7405ff10a5cfabdec00ee9ae02f2698.zip
Merge branch 'nightly' into release
Diffstat (limited to 'src/webview/badge.ts')
-rw-r--r--src/webview/badge.ts20
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';
3const debug = require('debug')('Ferdi:Plugin:BadgeHandler'); 3const debug = require('debug')('Ferdi:Plugin:BadgeHandler');
4 4
5export class BadgeHandler { 5export 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}