mirror of
https://github.com/Esri/offline-editor-js.git
synced 2025-12-15 15:20:05 +00:00
added some code comments for addtl clarification
This commit is contained in:
parent
3dd0ecb1fc
commit
03ff996ccb
@ -287,19 +287,31 @@ define([
|
||||
|
||||
/* internal methods */
|
||||
|
||||
/**
|
||||
* Makes a request to a tile url and uses that as a basis for the
|
||||
* the average tile size.
|
||||
* Future Iterations could call multiple tiles and do an actual average.
|
||||
* @param callback
|
||||
* @returns {Number} Returns NaN if there was a problem retrieving the tile
|
||||
*/
|
||||
layer.estimateTileSize = function(callback)
|
||||
{
|
||||
var url = this.offline.proxyPath + "?" + layer._tileUrlArr[0];
|
||||
var size = 0;
|
||||
request.get(url,{
|
||||
handleAs: "text/plain; charset=x-user-defined",
|
||||
headers: { // This is required to stop the
|
||||
"X-Requested-With": "" // server from rejecting the
|
||||
}
|
||||
}).then(function(response){
|
||||
var img = Base64Utils.wordToBase64(Base64Utils.stringToWord(response));
|
||||
callback(img.length + url.length);
|
||||
});
|
||||
if(layer._tileUrlArr.length > 0){
|
||||
var url = this.offline.proxyPath + "?" + layer._tileUrlArr[0];
|
||||
request.get(url,{
|
||||
handleAs: "text/plain; charset=x-user-defined",
|
||||
headers: {
|
||||
"X-Requested-With": "" //bypasses a dojo xhr bug
|
||||
}
|
||||
}).then(function(response){
|
||||
var img = Base64Utils.wordToBase64(Base64Utils.stringToWord(response));
|
||||
callback(img.length + url.length);
|
||||
});
|
||||
}
|
||||
else{
|
||||
return NaN;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
layer.doNextTile = function(i, cells, reportProgress)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user