loleaflet: activate the inactivity timer after document load
The timer is cancelled right after 'statusindicator' is received, so a document never really go to inactive mode after set inactivity time period (unless user refocuses the document). Call _activate() to ensure that timer is started after document is completely loaded. Also timer shouldn't really start when the document is not yet loaded. Change-Id: I58f5d7718c65cc37da9c3feb99ee6b16741a22a2
This commit is contained in:
parent
d0be89bffa
commit
8c74d4a38d
1 changed files with 5 additions and 3 deletions
|
@ -152,14 +152,16 @@ L.Map = L.Evented.extend({
|
|||
}, this);
|
||||
|
||||
this.on('docloaded', function(e) {
|
||||
if (e.status) {
|
||||
this._docLoaded = e.status;
|
||||
if (this._docLoaded) {
|
||||
// so that dim timer starts from now()
|
||||
this.lastActiveTime = Date.now();
|
||||
if (!document.hasFocus()) {
|
||||
this._deactivate();
|
||||
} else {
|
||||
this._activate();
|
||||
}
|
||||
}
|
||||
this._docLoaded = e.status;
|
||||
}, this);
|
||||
},
|
||||
|
||||
|
@ -906,7 +908,7 @@ L.Map = L.Evented.extend({
|
|||
},
|
||||
|
||||
_startInactiveTimer: function () {
|
||||
if (this._serverRecycling || this._documentIdle) {
|
||||
if (this._serverRecycling || this._documentIdle || !this._docLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue