mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 14:07:50 +00:00
[API] Fix paths for legacyRegistry
This commit is contained in:
parent
a39e8e44f0
commit
b87dd5def6
@ -60,7 +60,8 @@ define(
|
|||||||
*/
|
*/
|
||||||
BundleLoader.prototype.loadBundles = function (bundles) {
|
BundleLoader.prototype.loadBundles = function (bundles) {
|
||||||
var $http = this.$http,
|
var $http = this.$http,
|
||||||
$log = this.$log;
|
$log = this.$log,
|
||||||
|
legacyRegistry = this.legacyRegistry;
|
||||||
|
|
||||||
// Utility function; load contents of JSON file using $http
|
// Utility function; load contents of JSON file using $http
|
||||||
function getJSON(file) {
|
function getJSON(file) {
|
||||||
@ -97,10 +98,10 @@ define(
|
|||||||
// Load an individual bundle, as a Bundle object.
|
// Load an individual bundle, as a Bundle object.
|
||||||
// Returns undefined if the definition could not be loaded.
|
// Returns undefined if the definition could not be loaded.
|
||||||
function loadBundle(bundlePath) {
|
function loadBundle(bundlePath) {
|
||||||
if (this.legacyRegistry.contains(bundlePath)) {
|
if (legacyRegistry.contains(bundlePath)) {
|
||||||
return Promise.resolve(new Bundle(
|
return Promise.resolve(new Bundle(
|
||||||
bundlePath,
|
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
|
// Load all named bundles from the array, returned as an array
|
||||||
// of Bundle objects.
|
// of Bundle objects.
|
||||||
function loadBundlesFromArray(bundleArray) {
|
function loadBundlesFromArray(bundleArray) {
|
||||||
var bundlePromises = this.legacyRegistry.list()
|
var bundlePromises = legacyRegistry.list()
|
||||||
.concat(bundleArray)
|
.concat(bundleArray)
|
||||||
|
.filter(unique)
|
||||||
.map(loadBundle);
|
.map(loadBundle);
|
||||||
|
|
||||||
return Promise.all(bundlePromises)
|
return Promise.all(bundlePromises)
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*global define, window, requirejs*/
|
/*global define, window, requirejs*/
|
||||||
|
|
||||||
define(['./BundleRegistry'], function (BundleRegistry) {
|
define(['src/BundleRegistry'], function (BundleRegistry) {
|
||||||
'use strict';
|
'use strict';
|
||||||
return new BundleRegistry();
|
return new BundleRegistry();
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user