From fe5eff892397420b9846123e253721a05c24d5d5 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Sun, 27 Dec 2015 17:05:20 -0800 Subject: [PATCH] Include cosmopolite and hogfather. Delay construction until hogfather is ready. --- static/babystats.html | 2 ++ static/babystats.js | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/static/babystats.html b/static/babystats.html index b27ad06..2f21acb 100644 --- a/static/babystats.html +++ b/static/babystats.html @@ -2,6 +2,8 @@ BabyStats + + diff --git a/static/babystats.js b/static/babystats.js index 4f3e65f..a4057a4 100644 --- a/static/babystats.js +++ b/static/babystats.js @@ -23,16 +23,21 @@ var BabyStats = function(container) { this.intervals_ = {}; - this.buildCells_(); - this.buildStylesheet_(); - this.buildLayout_(); + this.cosmo_ = new Cosmopolite(); + hogfather.PublicChat.Create(this.cosmo_).then(function(chat) { + this.chat_ = chat; - window.addEventListener('resize', this.rebuildIfNeeded_.bind(this)); + this.buildCells_(); + this.buildStylesheet_(); + this.buildLayout_(); - var grid = this.calculateGrid_(); - this.gridWidthCells_ = grid.gridWidthCells; - this.gridHeightCells_ = grid.gridHeightCells; - this.buildGrid_(); + window.addEventListener('resize', this.rebuildIfNeeded_.bind(this)); + + var grid = this.calculateGrid_(); + this.gridWidthCells_ = grid.gridWidthCells; + this.gridHeightCells_ = grid.gridHeightCells; + this.buildGrid_(); + }.bind(this)); };