diff --git a/openseadragon.js b/openseadragon.js index 15a4bd2b..1d80d42c 100644 --- a/openseadragon.js +++ b/openseadragon.js @@ -8181,10 +8181,10 @@ $.Drawer.prototype = { * @method * @param {String} src - The url of the image to load. * @param {Function} callback - The function that will be called with the - * Image object as the only parameter, whether on 'load' or on 'abort'. - * For now this means the callback is expected to distinguish between - * error and success conditions by inspecting the Image object. - * @return {Boolean} loading - Wheter the request was submitted or ignored + * Image object as the only parameter if it was loaded successfully. + * If an error occured, or the request timed out or was aborted, + * the parameter is null instead. + * @return {Boolean} loading - Wheter the request was submitted or ignored * based on OpenSeadragon.DEFAULT_SETTINGS.imageLoaderLimit. */ loadImage: function( src, callback ) { @@ -8201,11 +8201,11 @@ $.Drawer.prototype = { image = new Image(); - complete = function( imagesrc ){ + complete = function( imagesrc, resultingImage ){ _this.downloading--; if (typeof ( callback ) == "function") { try { - callback( image ); + callback( resultingImage ); } catch ( e ) { $.console.error( "%s while executing %s callback: %s", @@ -8219,11 +8219,11 @@ $.Drawer.prototype = { }; image.onload = function(){ - finishLoadingImage( image, complete, true ); + finishLoadingImage( image, complete, true, jobid ); }; image.onabort = image.onerror = function(){ - finishLoadingImage( image, complete, false ); + finishLoadingImage( image, complete, false, jobid ); }; jobid = window.setTimeout( function(){ diff --git a/src/drawer.js b/src/drawer.js index 68834912..b974c447 100644 --- a/src/drawer.js +++ b/src/drawer.js @@ -275,10 +275,10 @@ $.Drawer.prototype = { * @method * @param {String} src - The url of the image to load. * @param {Function} callback - The function that will be called with the - * Image object as the only parameter, whether on 'load' or on 'abort'. - * For now this means the callback is expected to distinguish between - * error and success conditions by inspecting the Image object. - * @return {Boolean} loading - Wheter the request was submitted or ignored + * Image object as the only parameter if it was loaded successfully. + * If an error occured, or the request timed out or was aborted, + * the parameter is null instead. + * @return {Boolean} loading - Wheter the request was submitted or ignored * based on OpenSeadragon.DEFAULT_SETTINGS.imageLoaderLimit. */ loadImage: function( src, callback ) { @@ -295,11 +295,11 @@ $.Drawer.prototype = { image = new Image(); - complete = function( imagesrc ){ + complete = function( imagesrc, resultingImage ){ _this.downloading--; if (typeof ( callback ) == "function") { try { - callback( image ); + callback( resultingImage ); } catch ( e ) { $.console.error( "%s while executing %s callback: %s", @@ -313,11 +313,11 @@ $.Drawer.prototype = { }; image.onload = function(){ - finishLoadingImage( image, complete, true ); + finishLoadingImage( image, complete, true, jobid ); }; image.onabort = image.onerror = function(){ - finishLoadingImage( image, complete, false ); + finishLoadingImage( image, complete, false, jobid ); }; jobid = window.setTimeout( function(){