From ac401c78b30a6c1d064e3ff8a3bdabb53b36e9d2 Mon Sep 17 00:00:00 2001 From: lilia Date: Tue, 9 Jun 2015 11:30:35 -0700 Subject: [PATCH] Fix socket status indicator It was not correctly reporting the status after a background page reload. --- js/views/inbox_view.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/js/views/inbox_view.js b/js/views/inbox_view.js index 68e9e589c..1b12a897e 100644 --- a/js/views/inbox_view.js +++ b/js/views/inbox_view.js @@ -22,7 +22,10 @@ var SocketView = Whisper.View.extend({ className: 'status', initialize: function() { - setInterval(function() { + setInterval(this.updateStatus.bind(this), 1000); + }, + updateStatus: function() { + extension.windows.getBackground(function(bg) { var className, message = ''; switch(bg.getSocketStatus && bg.getSocketStatus()) { case WebSocket.CONNECTING: @@ -43,13 +46,15 @@ this.$el.attr('class', className); this.$el.text(message); } - }.bind(this), 1000); + }.bind(this)); }, events: { 'click': 'reloadBackgroundPage' }, reloadBackgroundPage: function() { - bg.location.reload(); + extension.windows.getBackground(function(bg) { + bg.location.reload(); + }); } });