Merge pull request #3343 from Programie/v3.0

Prevent updating map while invisible
This commit is contained in:
mikeprimm 2021-06-21 13:10:57 -05:00 committed by GitHub
commit bc51a14006
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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