From b65f5abf9266b1ec55b561d6bdf3115c80ac9d9d Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Tue, 11 Dec 2018 17:28:02 +0000 Subject: [PATCH] Page stops auto-refreshing when it's not active --- app/assets/javascripts/updateContent.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/assets/javascripts/updateContent.js b/app/assets/javascripts/updateContent.js index a8a6146d6..516bd913f 100644 --- a/app/assets/javascripts/updateContent.js +++ b/app/assets/javascripts/updateContent.js @@ -21,7 +21,7 @@ var poll = function(renderer, resource, queue, interval, form) { - if (queue.push(renderer) === 1) $.ajax( + if (document.visibilityState !== "hidden" && queue.push(renderer) === 1) $.ajax( resource, { 'method': form ? 'post' : 'get', @@ -36,7 +36,6 @@ setTimeout( () => poll(...arguments), interval ); - }; Modules.UpdateContent = function() {