From 76aa9e1fd23a21d4211dda59c525964b4cd5d2fb Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 6 Jan 2016 11:05:41 -0800 Subject: [PATCH] [API] Add legacy bundle registry --- main.js | 8 ++-- src/BundleRegistry.js | 42 ++++++++++++++++++++ src/{bundleRegistry.js => legacyRegistry.js} | 5 ++- 3 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 src/BundleRegistry.js rename src/{bundleRegistry.js => legacyRegistry.js} (91%) diff --git a/main.js b/main.js index 2bf5f4b597..e5b6f24519 100644 --- a/main.js +++ b/main.js @@ -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); }); \ No newline at end of file diff --git a/src/BundleRegistry.js b/src/BundleRegistry.js new file mode 100644 index 0000000000..4bf2f8091c --- /dev/null +++ b/src/BundleRegistry.js @@ -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; +}); \ No newline at end of file diff --git a/src/bundleRegistry.js b/src/legacyRegistry.js similarity index 91% rename from src/bundleRegistry.js rename to src/legacyRegistry.js index b5cbffb853..ff7a6f94f5 100644 --- a/src/bundleRegistry.js +++ b/src/legacyRegistry.js @@ -21,6 +21,7 @@ *****************************************************************************/ /*global define, window, requirejs*/ -define(function () { - return {}; +define(['./BundleRegistry'], function (BundleRegistry) { + 'use strict'; + return new BundleRegistry(); }); \ No newline at end of file