[API] Add legacy bundle registry

This commit is contained in:
Victor Woeltjen 2016-01-06 11:05:41 -08:00
parent 9f66f39d8d
commit 76aa9e1fd2
3 changed files with 49 additions and 6 deletions

View File

@ -23,7 +23,7 @@
requirejs.config({
"paths": {
"bundleRegistry": "./src/bundleRegistry",
"legacyRegistry": "./src/legacyRegistry",
"angular": "./platform/framework/lib/angular.min",
"angular-route": "./platform/framework/lib/angular-route.min"
},
@ -39,10 +39,10 @@ requirejs.config({
define([
'./platform/framework/src/Main',
'bundleRegistry',
'legacyRegistry',
"angular",
"angular-route"
], function (Main, bundleRegistry, angular) {
], function (Main, legacyRegistry, angular) {
'use strict';
new Main(angular).run(bundleRegistry);
new Main(angular).run(legacyRegistry);
});

42
src/BundleRegistry.js Normal file
View File

@ -0,0 +1,42 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(function () {
function BundleRegistry() {
this.bundles = {};
}
BundleRegistry.prototype.registry = function (path, definition) {
this.bundles[path] = definition;
};
BundleRegistry.prototype.contains = function (path) {
return !!this.bundles[path];
};
BundleRegistry.prototype.get = function (path) {
return this.bundles[path];
};
return BundleRegistry;
});

View File

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