Prevent updating map while invisible

This commit is contained in:
Michael Wieland 2021-04-19 19:06:38 +02:00
parent 490948a5ed
commit ce34a4db84

View File

@ -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