diff --git a/src/openseadragon.js b/src/openseadragon.js index be45ac07..cb9a534c 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -312,6 +312,10 @@ * it is set to 0 allowing the browser to make the maximum number of * image requests in parallel as allowed by the browsers policy. * + * @property {Number} [tileSourceLoaderLimit=0] + * The maximum number of tile source requests to make concurrently. By default + * it is set to 0 allowing an unlimited number of concurrent requests. + * * @property {Number} [clickTimeThreshold=300] * The number of milliseconds within which a pointer down-up event combination * will be treated as a click gesture. @@ -792,7 +796,7 @@ function OpenSeadragon( options ){ requestFuncs: [], numRequests: 0, numActiveRequests: 0, - maxConcurrency: 50, + maxConcurrency: 0, }; /** @@ -1339,6 +1343,7 @@ function OpenSeadragon( options ){ //PERFORMANCE SETTINGS imageLoaderLimit: 0, + tileSourceLoaderLimit: 0, maxImageCacheCount: 200, timeout: 30000, useCanvas: true, // Use canvas element for drawing if available @@ -2339,6 +2344,10 @@ function OpenSeadragon( options ){ }, queueAjaxRequest: function (request, sendRequestFunc) { + if(!$.ajaxQueue.maxConcurrency) { + sendRequestFunc(); + } + var oldOnStateChange = request.onreadystatechange; var onCompleteRequest = function() { diff --git a/src/viewer.js b/src/viewer.js index 3928ee02..48a77bcc 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -394,6 +394,10 @@ $.Viewer = function( options ) { timeout: options.timeout }); + // TODO: Instantiating a viewer shouldn't have + // a side effect on the global queue + $.ajaxQueue.maxConcurrency = options.tileSourceLoaderLimit; + // Create the tile cache this.tileCache = new $.TileCache({ maxImageCacheCount: this.maxImageCacheCount