Try to reconnect either on editor-cursor move, or when any thing in the page is clicked.

This commit is contained in:
Shane Kilkelly 2015-09-29 10:23:21 +01:00
parent 8bd83f64e0
commit b4c7209a11
2 changed files with 4 additions and 5 deletions

View file

@ -23,7 +23,7 @@ block content
.alert.alert-warning.small(ng-if="connection.reconnection_countdown")
strong #{translate("lost_connection")}.
| #{translate("reconnecting_in_x_secs", {seconds:"{{ connection.reconnection_countdown }}"})}.
a.pull-right(href, ng-click="tryReconnectNow()") #{translate("try_now")}
a#try-reconnect-now-button.pull-right(href, ng-click="tryReconnectNow()") #{translate("try_now")}
.alert.alert-warning.small(ng-if="connection.reconnecting")
strong #{translate("reconnecting")}...

View file

@ -19,13 +19,12 @@ define [], () ->
@$scope.tryReconnectNow = () =>
@tryReconnect()
@$scope.$on "editor:change", () =>
@lastUpdated = new Date()
@$scope.$on 'cursor:editor:update', () =>
if !@connected
@tryReconnect()
@$scope.$on 'cursor:editor:update', () =>
if !@connected
document.querySelector('body').addEventListener 'click', (e) =>
if !@connected and e.target.id != 'try-reconnect-now-button'
@tryReconnect()
@ide.socket = io.connect null,