Prevent updating map while invisible
This commit is contained in:
parent
490948a5ed
commit
ce34a4db84
1 changed files with 5 additions and 0 deletions
|
|
@ -636,6 +636,11 @@ DynMap.prototype = {
|
|||
update: function() {
|
||||
var me = this;
|
||||
|
||||
if (document.visibilityState === "hidden") {
|
||||
setTimeout(function() { me.update(); }, me.options.updaterate);
|
||||
return;
|
||||
}
|
||||
|
||||
$(me).trigger('worldupdating');
|
||||
$.getJSON(me.formatUrl('update', { world: me.world.name, timestamp: me.lasttimestamp, reqid: me.reqid }), function(update) {
|
||||
me.reqid++; // Bump request ID always
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue