Code restructure 3

This commit is contained in:
Xelio
2013-03-01 15:31:15 +08:00
parent a679710198
commit 4113991201
3 changed files with 22 additions and 21 deletions

View File

@ -49,17 +49,25 @@ window.requestData = function() {
$.each(tiles, function(ind, tls) {
data = { minLevelOfDetail: -1 };
data.boundsParamsList = tls;
window.requests.add(window.postAjax('getThinnedEntitiesV2', data, window.handleDataResponse, portalRenderLimit.handleFailRequest));
window.requests.add(window.postAjax('getThinnedEntitiesV2', data, window.handleDataResponse, window.handleFailedRequest));
});
}
// Handle failed map data request
window.handleFailedRequest = function() {
if(requests.isLastRequest('getThinnedEntitiesV2')) {
var leftOverPortals = portalRenderLimit.mergeLowLevelPortals(null);
handlePortalsRender(leftOverPortals);
}
}
// works on map data response and ensures entities are drawn/updated.
window.handleDataResponse = function(data, textStatus, jqXHR) {
// remove from active ajax queries list
if(!data || !data.result) {
window.failedRequestCount++;
console.warn(data);
portalRenderLimit.handleFailRequest();
handleFailedRequest();
return;
}