Fix socket status indicator

It was not correctly reporting the status after a background page reload.
This commit is contained in:
lilia 2015-06-09 11:30:35 -07:00
parent 6bcfa84d45
commit ac401c78b3

View file

@ -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();
});
}
});