Example #1
0
R.history = function(sources) {
	// {source_id: timestamp, ...} = sources
	var updates = [];
	for (var id in this._sources) {
		this._sources[id].history(sources, updates);
	}
	return u.sort(updates);
};
Example #2
0
V.applyUpdate = function (update) {
  this._history = this._history || []
  this._history.push(update)
  u.sort(this._history)
  while(this._history.length > this.histLength)
    this.emit('_remove', this._history.shift())
  this.emit('update', update[0])
  return true
}
LSS.history = function () {
  var hist = []
  var l = this.prefix.length
  var length = this.store.length
  for(var i = 0; i < length; i++) {
    var k = this.store.key(i)
    if(this.rx.test(k)) {
      try {
        var val = JSON.parse(this.store[k])

        //[value, source, ts] <-- stored like this
        val[0] = [k.substring(l), val[0]]
        hist.push(val)
      } catch (err) {
        console.error(err)
      }
    }
  }
  return sort(hist)
}