Passes the tileSourceLoaderLimit option through the viewer constructor.

This commit is contained in:
Chili Johnson 2022-11-28 12:53:00 -08:00
parent 4227e4fd9b
commit 55bb9cd3d1
2 changed files with 14 additions and 1 deletions

View File

@ -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() {

View File

@ -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