Skip to content

Commit

Permalink
[js:core] fix Studio-42#2862 stop autoSync when browser tab turn to b…
Browse files Browse the repository at this point in the history
…ackground
  • Loading branch information
nao-pon committed Feb 28, 2019
1 parent b11046b commit 55e8c20
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions js/elFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4643,6 +4643,15 @@ var elFinder = function(elm, opts, bootCallback) {
! self.enabled() && self.enable();
});
}

// When the browser tab turn to foreground/background
$(window).on('visibilitychange.' + namespace, function(e) {
var background = document.hidden || document.webkitHidden || document.msHidden;
// AutoSync turn On/Off
if (self.options.syncStart) {
self.autoSync(background? 'stop' : void(0));
}
});
});

// store instance in node
Expand Down

0 comments on commit 55e8c20

Please sign in to comment.