Keep a cache of messages bucketed by tile.

This commit is contained in:
Ian Gulliver
2015-12-31 08:36:13 -08:00
parent e3dce3569d
commit 6025e2be37

View File

@@ -206,6 +206,7 @@ BabyStats.prototype.handleMessage_ = function(isEvent, message) {
} else { } else {
tile.lastSeen = message.created; tile.lastSeen = message.created;
tile.active = true; tile.active = true;
tile.messages.push(message);
(tile.cancels || []).forEach(function(type) { (tile.cancels || []).forEach(function(type) {
tile2 = this.findTile_(type); tile2 = this.findTile_(type);
tile2.active = false; tile2.active = false;
@@ -325,6 +326,7 @@ BabyStats.prototype.buildCells_ = function() {
this.cells_ = []; this.cells_ = [];
this.tiles_.forEach(function(tile) { this.tiles_.forEach(function(tile) {
tile.active = false; tile.active = false;
tile.messages = [];
var cell = document.createElement('babyStatsCell'); var cell = document.createElement('babyStatsCell');
this.cells_.push(cell); this.cells_.push(cell);