Add delay before showing backend connection lost

This commit is contained in:
Mark McDowall 2013-11-30 13:47:42 -08:00
parent 6fde48ce6b
commit f1f13e6248
1 changed files with 10 additions and 6 deletions

View File

@ -29,6 +29,7 @@ define(
var tryingToReconnect = false; var tryingToReconnect = false;
var messengerId = 'signalR'; var messengerId = 'signalR';
var reconnectTimeout;
this.signalRconnection = $.connection('/signalr'); this.signalRconnection = $.connection('/signalr');
@ -47,15 +48,18 @@ define(
tryingToReconnect = true; tryingToReconnect = true;
Messenger.show({ reconnectTimeout = window.setTimeout(function () {
id : messengerId, Messenger.show({
type : 'info', id : messengerId,
hideAfter : 0, type : 'info',
message : 'Connection to backend lost, attempting to reconnect' hideAfter : 0,
}); message : 'Connection to backend lost, attempting to reconnect'
});
}, 10000);
}); });
this.signalRconnection.reconnected(function() { this.signalRconnection.reconnected(function() {
window.clearTimeout(reconnectTimeout);
tryingToReconnect = false; tryingToReconnect = false;
var currentVersion = StatusModel.get('version'); var currentVersion = StatusModel.get('version');