mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +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,14 +2472,21 @@ $.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--;
|
||||
loadImage: function(src, callback) {
|
||||
var _this = this;
|
||||
if (this.downloading >= this.imageLoaderLimit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var job = new $.Job(src, function(src, image){
|
||||
|
||||
_this.downloading--;
|
||||
if (typeof (callback) == "function") {
|
||||
try {
|
||||
callback(image);
|
||||
@ -2488,16 +2495,9 @@ $.ImageLoader.prototype = {
|
||||
" callback: " + e.message, e);
|
||||
}
|
||||
}
|
||||
},
|
||||
loadImage: function(src, callback) {
|
||||
if (this._downloading >= this.imageLoaderLimit) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var func = $.Utils.createCallback(null, $.delegate(this, this._onComplete), callback);
|
||||
var job = new $.Job(src, func);
|
||||
|
||||
this._downloading++;
|
||||
this.downloading++;
|
||||
job.start();
|
||||
|
||||
return true;
|
||||
|
@ -1,14 +1,21 @@
|
||||
|
||||
(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--;
|
||||
loadImage: function(src, callback) {
|
||||
var _this = this;
|
||||
if (this.downloading >= this.imageLoaderLimit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var job = new $.Job(src, function(src, image){
|
||||
|
||||
_this.downloading--;
|
||||
if (typeof (callback) == "function") {
|
||||
try {
|
||||
callback(image);
|
||||
@ -17,16 +24,9 @@ $.ImageLoader.prototype = {
|
||||
" callback: " + e.message, e);
|
||||
}
|
||||
}
|
||||
},
|
||||
loadImage: function(src, callback) {
|
||||
if (this._downloading >= this.imageLoaderLimit) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var func = $.Utils.createCallback(null, $.delegate(this, this._onComplete), callback);
|
||||
var job = new $.Job(src, func);
|
||||
|
||||
this._downloading++;
|
||||
this.downloading++;
|
||||
job.start();
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user