signalk-polar-performance-plugin 0.0.47 → 0.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin/index.js +16 -13
package/package.json
CHANGED
package/plugin/index.js
CHANGED
|
@@ -213,14 +213,12 @@ module.exports = function (app) {
|
|
|
213
213
|
function sendUpdates (perfObj) {
|
|
214
214
|
let values = []
|
|
215
215
|
let metas = []
|
|
216
|
-
let currentTime = new Date().getTime()
|
|
217
216
|
|
|
218
217
|
function addValue (path, value, meta) {
|
|
219
218
|
if (lastValues[path] !== value) {
|
|
220
219
|
values.push({
|
|
221
220
|
path: path,
|
|
222
|
-
value: roundDec(value)
|
|
223
|
-
timestamp: currentTime
|
|
221
|
+
value: roundDec(value)
|
|
224
222
|
})
|
|
225
223
|
if (meta) {
|
|
226
224
|
metas.push({ path: path, value: meta })
|
|
@@ -316,21 +314,26 @@ module.exports = function (app) {
|
|
|
316
314
|
}
|
|
317
315
|
}
|
|
318
316
|
|
|
319
|
-
|
|
317
|
+
if (firstUpdate) {
|
|
318
|
+
// Send meta updates
|
|
319
|
+
app.handleMessage(plugin.id, {
|
|
320
|
+
updates: [
|
|
321
|
+
{
|
|
322
|
+
meta: metas
|
|
323
|
+
}
|
|
324
|
+
]
|
|
325
|
+
})
|
|
326
|
+
firstUpdate = false
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Send values updates
|
|
330
|
+
app.handleMessage(plugin.id, {
|
|
320
331
|
updates: [
|
|
321
332
|
{
|
|
322
333
|
values: values
|
|
323
334
|
}
|
|
324
335
|
]
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
if (firstUpdate) {
|
|
328
|
-
updates.updates[0].metas = metas
|
|
329
|
-
firstUpdate = false
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// Send updates
|
|
333
|
-
app.handleMessage(plugin.id, updates)
|
|
336
|
+
})
|
|
334
337
|
}
|
|
335
338
|
|
|
336
339
|
function getPerformanceData (TWS, TWA, BSP) {
|