From ba44f76ba8a80387babd0e3ff6bd881a9e6f3a35 Mon Sep 17 00:00:00 2001 From: Endel Dreyer Date: Tue, 3 Jan 2017 15:59:23 +0100 Subject: [PATCH 1/2] return child loaders when adding one or multiple items. --- src/preloadjs/LoadQueue.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/preloadjs/LoadQueue.js b/src/preloadjs/LoadQueue.js index adf41be..96a876a 100644 --- a/src/preloadjs/LoadQueue.js +++ b/src/preloadjs/LoadQueue.js @@ -1090,13 +1090,15 @@ this.createjs = this.createjs || {}; this._sendError(event); return; } - this._addItem(file, null, basePath); + var loader = this._addItem(file, null, basePath); if (loadNow !== false) { this.setPaused(false); } else { this.setPaused(true); } + + return loader; }; /** @@ -1187,8 +1189,9 @@ this.createjs = this.createjs || {}; return; } + var items = []; for (var i = 0, l = fileList.length; i < l; i++) { - this._addItem(fileList[i], path, basePath); + items.push(this._addItem(fileList[i], path, basePath)); } if (loadNow !== false) { @@ -1197,6 +1200,7 @@ this.createjs = this.createjs || {}; this.setPaused(true); } + return items; }; /** @@ -1363,6 +1367,7 @@ this.createjs = this.createjs || {}; this._loadedScripts.push(null); } } + return loader; }; /** From c98ccf56227d445f8a250b22a0e7fed152113365 Mon Sep 17 00:00:00 2001 From: Endel Dreyer Date: Tue, 3 Jan 2017 16:11:13 +0100 Subject: [PATCH 2/2] add return value on documentation --- src/preloadjs/LoadQueue.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/preloadjs/LoadQueue.js b/src/preloadjs/LoadQueue.js index 96a876a..2a5260c 100644 --- a/src/preloadjs/LoadQueue.js +++ b/src/preloadjs/LoadQueue.js @@ -1083,6 +1083,7 @@ this.createjs = this.createjs || {}; * its files will NOT use the basePath parameter. The basePath parameter is deprecated. * This parameter will be removed in a future version. Please either use the `basePath` parameter in the LoadQueue * constructor, or a `path` property in a manifest definition. + * @return {AbstractLoader} The loader for the file */ p.loadFile = function (file, loadNow, basePath) { if (file == null) { @@ -1338,6 +1339,7 @@ this.createjs = this.createjs || {}; * @param {String} [basePath] DeprecatedAn optional basePath passed into a {{#crossLink "LoadQueue/loadManifest"}}{{/crossLink}} * or {{#crossLink "LoadQueue/loadFile"}}{{/crossLink}} call. This parameter will be removed in a future tagged * version. + * @return {AbstractLoader} The loader for the file * @private */ p._addItem = function (value, path, basePath) {