[API] Fix paths for legacyRegistry

This commit is contained in:
Victor Woeltjen 2016-01-06 17:50:05 -08:00
parent a39e8e44f0
commit b87dd5def6
2 changed files with 12 additions and 5 deletions

View File

@ -60,7 +60,8 @@ define(
*/
BundleLoader.prototype.loadBundles = function (bundles) {
var $http = this.$http,
$log = this.$log;
$log = this.$log,
legacyRegistry = this.legacyRegistry;
// Utility function; load contents of JSON file using $http
function getJSON(file) {
@ -97,10 +98,10 @@ define(
// Load an individual bundle, as a Bundle object.
// Returns undefined if the definition could not be loaded.
function loadBundle(bundlePath) {
if (this.legacyRegistry.contains(bundlePath)) {
if (legacyRegistry.contains(bundlePath)) {
return Promise.resolve(new Bundle(
bundlePath,
this.legacyRegistry.get(bundlePath)
legacyRegistry.get(bundlePath)
));
}
@ -109,11 +110,17 @@ define(
});
}
// Used to filter out redundant bundles
function unique(element, index, array) {
return array.indexOf(element) === index;
}
// Load all named bundles from the array, returned as an array
// of Bundle objects.
function loadBundlesFromArray(bundleArray) {
var bundlePromises = this.legacyRegistry.list()
var bundlePromises = legacyRegistry.list()
.concat(bundleArray)
.filter(unique)
.map(loadBundle);
return Promise.all(bundlePromises)

View File

@ -21,7 +21,7 @@
*****************************************************************************/
/*global define, window, requirejs*/
define(['./BundleRegistry'], function (BundleRegistry) {
define(['src/BundleRegistry'], function (BundleRegistry) {
'use strict';
return new BundleRegistry();
});