signalk-multiplexer
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -120,2 +120,39 @@ var events = require("events") | ||
Multiplexer.prototype.values = function(arr) { | ||
var ts, src; | ||
this._last = _.clone(this._data, true); | ||
if(this._setTimestamp) { | ||
ts = this._setTimestamp; | ||
} else { | ||
ts = new Date().toISOString(); | ||
} | ||
if(this._setSource) { | ||
src = this._setSource; | ||
} else { | ||
src = {}; | ||
} | ||
for(var i in arr) { | ||
var prop = arr[i].path; | ||
var val = arr[i].value; | ||
this.__select(this._setPath)[prop] = { | ||
timestamp: ts, | ||
source: src, | ||
value: val | ||
}; | ||
} | ||
if(this.hasChanged()) { | ||
this._lastChange = Date.now(); | ||
this.emit('change', this._data); | ||
this.emit('change:delta', this.__generateDelta(this._context, this._setPath + '.' + prop, val, ts, src)); | ||
} | ||
return this.root(); | ||
}; | ||
/* | ||
@@ -122,0 +159,0 @@ * PRIVATE METHODS |
{ | ||
"name": "signalk-multiplexer", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "A multiplexer for Signal K that merges any incoming Signal K (either full or delta) into an in-memory Signal K tree, tracks changes and emits events when appropiate. Optionally takes a settings object with vessel information and/or filters. ", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
17134
565