Fix socket status indicator
It was not correctly reporting the status after a background page reload.
This commit is contained in:
parent
6bcfa84d45
commit
ac401c78b3
1 changed files with 8 additions and 3 deletions
|
@ -22,7 +22,10 @@
|
||||||
var SocketView = Whisper.View.extend({
|
var SocketView = Whisper.View.extend({
|
||||||
className: 'status',
|
className: 'status',
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
setInterval(function() {
|
setInterval(this.updateStatus.bind(this), 1000);
|
||||||
|
},
|
||||||
|
updateStatus: function() {
|
||||||
|
extension.windows.getBackground(function(bg) {
|
||||||
var className, message = '';
|
var className, message = '';
|
||||||
switch(bg.getSocketStatus && bg.getSocketStatus()) {
|
switch(bg.getSocketStatus && bg.getSocketStatus()) {
|
||||||
case WebSocket.CONNECTING:
|
case WebSocket.CONNECTING:
|
||||||
|
@ -43,13 +46,15 @@
|
||||||
this.$el.attr('class', className);
|
this.$el.attr('class', className);
|
||||||
this.$el.text(message);
|
this.$el.text(message);
|
||||||
}
|
}
|
||||||
}.bind(this), 1000);
|
}.bind(this));
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'click': 'reloadBackgroundPage'
|
'click': 'reloadBackgroundPage'
|
||||||
},
|
},
|
||||||
reloadBackgroundPage: function() {
|
reloadBackgroundPage: function() {
|
||||||
bg.location.reload();
|
extension.windows.getBackground(function(bg) {
|
||||||
|
bg.location.reload();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue