From b87dd5def6d29dca986e93411f85236d3b3d78ed Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 6 Jan 2016 17:50:05 -0800 Subject: [PATCH] [API] Fix paths for legacyRegistry --- platform/framework/src/load/BundleLoader.js | 15 +++++++++++---- src/legacyRegistry.js | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/platform/framework/src/load/BundleLoader.js b/platform/framework/src/load/BundleLoader.js index 737771809f..ee6fb0a0e9 100644 --- a/platform/framework/src/load/BundleLoader.js +++ b/platform/framework/src/load/BundleLoader.js @@ -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) diff --git a/src/legacyRegistry.js b/src/legacyRegistry.js index ff7a6f94f5..f7a8d13b06 100644 --- a/src/legacyRegistry.js +++ b/src/legacyRegistry.js @@ -21,7 +21,7 @@ *****************************************************************************/ /*global define, window, requirejs*/ -define(['./BundleRegistry'], function (BundleRegistry) { +define(['src/BundleRegistry'], function (BundleRegistry) { 'use strict'; return new BundleRegistry(); }); \ No newline at end of file