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