performance improvement: compute ap stats runs less often during rendering, as it's relatively expensive and slows things down
This commit is contained in:
parent
adc5d16297
commit
170a370099
@ -2,7 +2,7 @@
|
|||||||
// @id iitc-plugin-compute-ap-stats@Hollow011
|
// @id iitc-plugin-compute-ap-stats@Hollow011
|
||||||
// @name IITC plugin: Compute AP statistics
|
// @name IITC plugin: Compute AP statistics
|
||||||
// @category Info
|
// @category Info
|
||||||
// @version 0.4.0.@@DATETIMEVERSION@@
|
// @version 0.4.1.@@DATETIMEVERSION@@
|
||||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||||
// @updateURL @@UPDATEURL@@
|
// @updateURL @@UPDATEURL@@
|
||||||
// @downloadURL @@DOWNLOADURL@@
|
// @downloadURL @@DOWNLOADURL@@
|
||||||
@ -36,11 +36,22 @@ window.plugin.compAPStats.setupCallback = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.plugin.compAPStats.mapDataRefreshEnd = function() {
|
window.plugin.compAPStats.mapDataRefreshEnd = function() {
|
||||||
|
if (window.plugin.compAPStats.timer) {
|
||||||
|
clearTimeout(window.plugin.compAPStats.timer);
|
||||||
|
window.plugin.compAPStats.timer = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
window.plugin.compAPStats.update(true);
|
window.plugin.compAPStats.update(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.plugin.compAPStats.requestFinished = function() {
|
window.plugin.compAPStats.requestFinished = function() {
|
||||||
window.plugin.compAPStats.update(false);
|
// process on a short delay, so if multiple requests finish in a short time we only calculate once
|
||||||
|
if (window.plugin.compAPStats.timer === undefined) {
|
||||||
|
window.plugin.compAPStats.timer = setTimeout( function() {
|
||||||
|
window.plugin.compAPStats.timer = undefined;
|
||||||
|
window.plugin.compAPStats.update(false);
|
||||||
|
}, 0.75*1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.plugin.compAPStats.update = function(hasFinished) {
|
window.plugin.compAPStats.update = function(hasFinished) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user