From 9eb4dd1b3b90d1f477a395141e543d5454666cfa Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 14 Oct 2015 16:25:48 +0100 Subject: [PATCH] on firefox don't show retrying connected message if the user clicked to change page it creates a bit of worry for the user as it looks like the connection was not there. --- .../public/coffee/ide/connection/ConnectionManager.coffee | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/web/public/coffee/ide/connection/ConnectionManager.coffee b/services/web/public/coffee/ide/connection/ConnectionManager.coffee index c2f6cee435..6625f02f9f 100644 --- a/services/web/public/coffee/ide/connection/ConnectionManager.coffee +++ b/services/web/public/coffee/ide/connection/ConnectionManager.coffee @@ -17,6 +17,10 @@ define [], () -> @disconnectIfInactive() , ONEHOUR) + @userIsLeavingPage = false + window.addEventListener 'beforeunload', => + @userIsLeavingPage = true + @connected = false @userIsInactive = false @@ -122,6 +126,9 @@ define [], () -> else countdown = 3 + Math.floor(Math.random() * 7) + if @userIsLeavingPage #user will have pressed refresh or back etc + return + @$scope.$apply () => @$scope.connection.reconnecting = false @$scope.connection.reconnection_countdown = countdown