From 7c62974e57ee12ffafa22379b416ff6a45a47ce0 Mon Sep 17 00:00:00 2001 From: Antoine Vandecreme Date: Mon, 9 Nov 2015 18:19:17 -0500 Subject: [PATCH] Exit early if an array is provided as a tile source. --- src/viewer.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index 93235038..5dbd814c 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1286,19 +1286,21 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, } } + if ($.isArray(options.tileSource)) { + setTimeout(function() { + raiseAddItemFailed({ + message: "[Viewer.addTiledImage] Sequences can not be added; add them one at a time instead.", + source: options.tileSource, + options: options + }); + }); + return; + } + this._loadQueue.push(myQueueItem); getTileSourceImplementation( this, options.tileSource, function( tileSource ) { - if ( tileSource instanceof Array ) { - raiseAddItemFailed({ - message: "[Viewer.addTiledImage] Sequences can not be added; add them one at a time instead.", - source: tileSource, - options: options - }); - return; - } - myQueueItem.tileSource = tileSource; // add everybody at the front of the queue that's ready to go @@ -2101,8 +2103,6 @@ function getTileSourceImplementation( viewer, tileSource, successCallback, var options = $TileSource.prototype.configure.apply( _this, [ tileSource ] ); waitUntilReady(new $TileSource(options), tileSource); } - } else if ($.isArray(tileSource)) { - successCallback(tileSource); } else { //can assume it's already a tile source implementation waitUntilReady(tileSource, tileSource);