possible performance improvement - status bar display updated moved to a timer.
so 1. it happens after any delays rendering in the browser and 2. performance (no repeated updates one after another - possible browser style recalculations) could move more of the code into the timer event?
This commit is contained in:
parent
4dd944a642
commit
d019ebd15b
@ -2,6 +2,8 @@
|
||||
|
||||
// gives user feedback about pending operations. Draws current status
|
||||
// to website. Updates info in layer chooser.
|
||||
window.renderUpdateStatusTimer_ = undefined;
|
||||
|
||||
window.renderUpdateStatus = function() {
|
||||
var progress = 1;
|
||||
|
||||
@ -41,28 +43,6 @@ window.renderUpdateStatus = function() {
|
||||
t += '...unknown...';
|
||||
}
|
||||
|
||||
/*
|
||||
if(mapRunsUserAction)
|
||||
t += '<span class="help" title="Paused due to user interaction">paused</span';
|
||||
else if(isIdle())
|
||||
t += '<span style="color:#888">Idle</span>';
|
||||
else if(window.requests._quickRefreshPending)
|
||||
t += 'refreshing';
|
||||
else if(window.activeRequests.length > 0)
|
||||
t += window.activeRequests.length + ' requests';
|
||||
else {
|
||||
// tooltip with detailed tile counts
|
||||
t += '<span class="help" title="'+window.statusTotalMapTiles+' tiles: '+window.statusCachedMapTiles+' cached, '+window.statusSuccessMapTiles+' successful, '+window.statusStaleMapTiles+' stale, '+window.statusErrorMapTiles+' failed">';
|
||||
|
||||
// basic error/out of date/up to date message
|
||||
if (window.statusErrorMapTiles) t += '<span style="color:#f66">Errors</span>';
|
||||
else if (window.statusStaleMapTiles) t += '<span style="color:#fa6">Out of date</span>';
|
||||
else t += 'Up to date';
|
||||
|
||||
t += '</span>';
|
||||
|
||||
}
|
||||
*/
|
||||
t += '</span>';
|
||||
|
||||
//request status
|
||||
@ -72,6 +52,14 @@ window.renderUpdateStatus = function() {
|
||||
t += ' <span style="color:#f66">' + window.failedRequestCount + ' failed</span>'
|
||||
|
||||
|
||||
//it's possible that updating the status bar excessively causes some performance issues. so rather than doing it
|
||||
//immediately, delay it to the next javascript event loop, cancelling any pending update
|
||||
// will also cause any browser-related rendering to occur first, before the status actually updates
|
||||
|
||||
if (window.renderUpdateStatusTimer_) clearTimeout(window.renderUpdateStatusTimer_);
|
||||
|
||||
window.renderUpdateStatusTimer_ = setTimeout ( function() {
|
||||
window.renderUpdateStatusTimer_ = undefined;
|
||||
|
||||
$('#innerstatus').html(t);
|
||||
//$('#updatestatus').click(function() { startRefreshTimeout(10); });
|
||||
@ -84,4 +72,6 @@ window.renderUpdateStatus = function() {
|
||||
|
||||
if (typeof android !== 'undefined' && android && android.setProgress)
|
||||
android.setProgress(progress);
|
||||
}, 0);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user