Skip to content

return child loaders when adding one or multiple items. #221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/preloadjs/LoadQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -1083,20 +1083,23 @@ this.createjs = this.createjs || {};
* its files will <strong>NOT</strong> use the basePath parameter. <strong>The basePath parameter is deprecated.</strong>
* 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) {
var event = new createjs.ErrorEvent("PRELOAD_NO_FILE");
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;
};

/**
Expand Down Expand Up @@ -1187,8 +1190,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) {
Expand All @@ -1197,6 +1201,7 @@ this.createjs = this.createjs || {};
this.setPaused(true);
}

return items;
};

/**
Expand Down Expand Up @@ -1334,6 +1339,7 @@ this.createjs = this.createjs || {};
* @param {String} [basePath] <strong>Deprecated</strong>An 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) {
Expand Down Expand Up @@ -1363,6 +1369,7 @@ this.createjs = this.createjs || {};
this._loadedScripts.push(null);
}
}
return loader;
};

/**
Expand Down