mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-26 17:24:23 -04:00
Merge pull request #2577 from alphagov/disable_ajax_if_inactive
Page stops auto-refreshing when it's not active
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
var poll = function(renderer, resource, queue, interval, form) {
|
var poll = function(renderer, resource, queue, interval, form) {
|
||||||
|
|
||||||
if (queue.push(renderer) === 1) $.ajax(
|
if (document.visibilityState !== "hidden" && queue.push(renderer) === 1) $.ajax(
|
||||||
resource,
|
resource,
|
||||||
{
|
{
|
||||||
'method': form ? 'post' : 'get',
|
'method': form ? 'post' : 'get',
|
||||||
@@ -36,7 +36,6 @@
|
|||||||
setTimeout(
|
setTimeout(
|
||||||
() => poll(...arguments), interval
|
() => poll(...arguments), interval
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Modules.UpdateContent = function() {
|
Modules.UpdateContent = function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user