mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
removed psuedo-privacy anti-patterns from imageloader.js in favor of simple pinning and public properties.
This commit is contained in:
parent
c7706ba66c
commit
de14271399
@ -2472,32 +2472,32 @@ $.Job.prototype = {
|
||||
|
||||
(function( $ ){
|
||||
|
||||
$.ImageLoader = function(imageLoaderLimit) {
|
||||
this._downloading = 0;
|
||||
$.ImageLoader = function( imageLoaderLimit ) {
|
||||
this.downloading = 0;
|
||||
this.imageLoaderLimit = imageLoaderLimit;
|
||||
};
|
||||
|
||||
$.ImageLoader.prototype = {
|
||||
_onComplete: function(callback, src, image) {
|
||||
this._downloading--;
|
||||
if (typeof (callback) == "function") {
|
||||
try {
|
||||
callback(image);
|
||||
} catch (e) {
|
||||
$.Debug.error(e.name + " while executing " + src +
|
||||
" callback: " + e.message, e);
|
||||
}
|
||||
}
|
||||
},
|
||||
loadImage: function(src, callback) {
|
||||
if (this._downloading >= this.imageLoaderLimit) {
|
||||
var _this = this;
|
||||
if (this.downloading >= this.imageLoaderLimit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var func = $.Utils.createCallback(null, $.delegate(this, this._onComplete), callback);
|
||||
var job = new $.Job(src, func);
|
||||
var job = new $.Job(src, function(src, image){
|
||||
|
||||
_this.downloading--;
|
||||
if (typeof (callback) == "function") {
|
||||
try {
|
||||
callback(image);
|
||||
} catch (e) {
|
||||
$.Debug.error(e.name + " while executing " + src +
|
||||
" callback: " + e.message, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this._downloading++;
|
||||
this.downloading++;
|
||||
job.start();
|
||||
|
||||
return true;
|
||||
|
@ -1,32 +1,32 @@
|
||||
|
||||
(function( $ ){
|
||||
|
||||
$.ImageLoader = function(imageLoaderLimit) {
|
||||
this._downloading = 0;
|
||||
$.ImageLoader = function( imageLoaderLimit ) {
|
||||
this.downloading = 0;
|
||||
this.imageLoaderLimit = imageLoaderLimit;
|
||||
};
|
||||
|
||||
$.ImageLoader.prototype = {
|
||||
_onComplete: function(callback, src, image) {
|
||||
this._downloading--;
|
||||
if (typeof (callback) == "function") {
|
||||
try {
|
||||
callback(image);
|
||||
} catch (e) {
|
||||
$.Debug.error(e.name + " while executing " + src +
|
||||
" callback: " + e.message, e);
|
||||
}
|
||||
}
|
||||
},
|
||||
loadImage: function(src, callback) {
|
||||
if (this._downloading >= this.imageLoaderLimit) {
|
||||
var _this = this;
|
||||
if (this.downloading >= this.imageLoaderLimit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var func = $.Utils.createCallback(null, $.delegate(this, this._onComplete), callback);
|
||||
var job = new $.Job(src, func);
|
||||
var job = new $.Job(src, function(src, image){
|
||||
|
||||
_this.downloading--;
|
||||
if (typeof (callback) == "function") {
|
||||
try {
|
||||
callback(image);
|
||||
} catch (e) {
|
||||
$.Debug.error(e.name + " while executing " + src +
|
||||
" callback: " + e.message, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this._downloading++;
|
||||
this.downloading++;
|
||||
job.start();
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user