aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--src/webview/badge.ts20
2 files changed, 2 insertions, 20 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4459c46f7..a7cd0df55 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -196,7 +196,7 @@ DEBUG=Ferdi:* npm run start
196- Optionally, you can run both commands in one terminal with [concurrently](https://www.npmjs.com/package/concurrently): 196- Optionally, you can run both commands in one terminal with [concurrently](https://www.npmjs.com/package/concurrently):
197 197
198```bash 198```bash
199DEBUG=Ferdi:* npm run start:all-dev 199DEBUG_COLORS=1 DEBUG=Ferdi:* npm run start:all-dev
200``` 200```
201 201
202Note: please prefer [`debug()`](https://github.com/visionmedia/debug) over `console.log()`. 202Note: please prefer [`debug()`](https://github.com/visionmedia/debug) over `console.log()`.
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}