mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 14:46:10 +03:00
Add job queue full event.
This commit is contained in:
parent
e0f442209b
commit
cdb89ff5ad
@ -198,6 +198,7 @@ $.ImageLoader.prototype = {
|
||||
* requests.
|
||||
* @param {Function} [options.callback] - Called once image has been downloaded.
|
||||
* @param {Function} [options.abort] - Called when this image job is aborted.
|
||||
* @returns {boolean} true if job was immediatelly started, false if queued
|
||||
*/
|
||||
addJob: function(options) {
|
||||
if (!options.source) {
|
||||
@ -229,10 +230,10 @@ $.ImageLoader.prototype = {
|
||||
if ( !this.jobLimit || this.jobsInProgress < this.jobLimit ) {
|
||||
newJob.start();
|
||||
this.jobsInProgress++;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
this.jobQueue.push( newJob );
|
||||
}
|
||||
this.jobQueue.push( newJob );
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -2042,7 +2042,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
||||
var _this = this;
|
||||
tile.loading = true;
|
||||
tile.tiledImage = this;
|
||||
this._imageLoader.addJob({
|
||||
if (!this._imageLoader.addJob({
|
||||
src: tile.getUrl(),
|
||||
tile: tile,
|
||||
source: this.source,
|
||||
@ -2057,7 +2057,23 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
||||
abort: function() {
|
||||
tile.loading = false;
|
||||
}
|
||||
});
|
||||
})) {
|
||||
/**
|
||||
* Triggered if tile load job was added to a full queue.
|
||||
* This allows to react upon e.g. network not being able to serve the tiles fast enough.
|
||||
* @event job-queue-full
|
||||
* @memberof OpenSeadragon.Viewer
|
||||
* @type {object}
|
||||
* @property {OpenSeadragon.Tile} tile - The tile that failed to load.
|
||||
* @property {OpenSeadragon.TiledImage} tiledImage - The tiled image the tile belongs to.
|
||||
* @property {number} time - The time in milliseconds when the tile load began.
|
||||
*/
|
||||
this.viewer.raiseEvent("job-queue-full", {
|
||||
tile: tile,
|
||||
tiledImage: this,
|
||||
time: time,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user