From 0b1e616e071011707b5c57741e45d3b8d1be1d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20T=C3=B3th?= Date: Wed, 11 Dec 2024 22:07:03 +0100 Subject: [PATCH 1/5] fix emitter name --- packages/streams/n2kAnalyzer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/streams/n2kAnalyzer.js b/packages/streams/n2kAnalyzer.js index fd68563e6..5c1c09168 100644 --- a/packages/streams/n2kAnalyzer.js +++ b/packages/streams/n2kAnalyzer.js @@ -50,7 +50,7 @@ function N2KAnalyzer(options) { try { parsed = JSON.parse(data) that.push(parsed) - options.app.emit(this.analyzerOutEvent, parsed) + options.app.emit(that.analyzerOutEvent, parsed) } catch (ex) { console.error(data) console.error(ex.stack) From d238a9252eae27de812b114e6d6fb96d28827dd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20T=C3=B3th?= Date: Thu, 12 Dec 2024 00:23:44 +0100 Subject: [PATCH 2/5] avoid global namespace pollution --- packages/streams/n2kAnalyzer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/streams/n2kAnalyzer.js b/packages/streams/n2kAnalyzer.js index 5c1c09168..44e27f0d6 100644 --- a/packages/streams/n2kAnalyzer.js +++ b/packages/streams/n2kAnalyzer.js @@ -48,7 +48,7 @@ function N2KAnalyzer(options) { const that = this this.linereader.on('line', function (data) { try { - parsed = JSON.parse(data) + let parsed = JSON.parse(data) that.push(parsed) options.app.emit(that.analyzerOutEvent, parsed) } catch (ex) { From 08d8b0f5312ab601ab972569b896a7e728e6b712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20T=C3=B3th?= Date: Thu, 12 Dec 2024 00:24:00 +0100 Subject: [PATCH 3/5] avoid startup error message --- packages/streams/n2kAnalyzer.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/streams/n2kAnalyzer.js b/packages/streams/n2kAnalyzer.js index 44e27f0d6..d07a07048 100644 --- a/packages/streams/n2kAnalyzer.js +++ b/packages/streams/n2kAnalyzer.js @@ -49,6 +49,10 @@ function N2KAnalyzer(options) { this.linereader.on('line', function (data) { try { let parsed = JSON.parse(data) + if ( parsed.version ) { + console.log('Connected to analyzer v'+parsed.version); + return; + } that.push(parsed) options.app.emit(that.analyzerOutEvent, parsed) } catch (ex) { From 95838d8ce543ac0e800e3b30a6d5f19cc820c237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20T=C3=B3th?= Date: Thu, 12 Dec 2024 00:24:48 +0100 Subject: [PATCH 4/5] ignore IntelliJ IDEA project file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b90e7bff9..0308b0b2e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ logs/* bower_components settings/ssl-key.pem settings/ssl-cert.pem +/*.iml *.tgz work/ From 6b51436f32ac9291909a988f3276b6e721546eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20T=C3=B3th?= Date: Sat, 14 Dec 2024 22:39:01 +0100 Subject: [PATCH 5/5] apply code formatting --- packages/streams/n2kAnalyzer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/streams/n2kAnalyzer.js b/packages/streams/n2kAnalyzer.js index d07a07048..36b9270c6 100644 --- a/packages/streams/n2kAnalyzer.js +++ b/packages/streams/n2kAnalyzer.js @@ -49,9 +49,9 @@ function N2KAnalyzer(options) { this.linereader.on('line', function (data) { try { let parsed = JSON.parse(data) - if ( parsed.version ) { - console.log('Connected to analyzer v'+parsed.version); - return; + if (parsed.version) { + console.log('Connected to analyzer v' + parsed.version) + return } that.push(parsed) options.app.emit(that.analyzerOutEvent, parsed)