mirror of
https://github.com/nasa/openmct.git
synced 2024-12-18 20:57:53 +00:00
[Framework] Wire up framework layer
Wire up and invoke framework layer components for application start up, from main point-of-entry. WTD-518.
This commit is contained in:
parent
8e31b2b6e0
commit
19bfeb4d03
@ -1,4 +1,4 @@
|
||||
/*global define, requirejs*/
|
||||
/*global define, window, requirejs*/
|
||||
|
||||
requirejs.config({
|
||||
"shim": {
|
||||
@ -13,20 +13,67 @@ define(
|
||||
'require',
|
||||
'../lib/es6-promise-2.0.0.min',
|
||||
'../lib/angular.min',
|
||||
'./BundleLoader'
|
||||
'./Constants',
|
||||
'./FrameworkInitializer',
|
||||
'./BundleLoader',
|
||||
'./ImplementationLoader',
|
||||
'./ExtensionResolver',
|
||||
'./BundleResolver',
|
||||
'./CustomRegistrars',
|
||||
'./ExtensionRegistrar',
|
||||
'./ApplicationBootstrapper'
|
||||
],
|
||||
function (require, es6promise, angular) {
|
||||
function (require,
|
||||
es6promise,
|
||||
angular,
|
||||
Constants,
|
||||
FrameworkInitializer,
|
||||
BundleLoader,
|
||||
ImplementationLoader,
|
||||
ExtensionResolver,
|
||||
BundleResolver,
|
||||
CustomRegistrars,
|
||||
ExtensionRegistrar,
|
||||
ApplicationBootstrapper
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
// Get a reference to Angular's injector, so we can get $http and $log
|
||||
// services, which are useful to the framework layer.
|
||||
var injector = angular.injector(['ng']);
|
||||
|
||||
// Polyfill Promise, in case browser does not natively provide Promise
|
||||
window.Promise = window.Promise || es6promise.Promise;
|
||||
|
||||
injector.invoke(['$http', function ($http) {
|
||||
return $http.get('bundles.json').then(function (b) {
|
||||
console.log(b);
|
||||
});
|
||||
}]);
|
||||
// Wire up framework layer components necessary to complete framework
|
||||
// initialization phases.
|
||||
function initializeApplication($http, $log) {
|
||||
var app = angular.module(Constants.MODULE_NAME, []),
|
||||
loader = new BundleLoader($http, $log),
|
||||
resolver = new BundleResolver(new ExtensionResolver(
|
||||
new ImplementationLoader(require),
|
||||
$log
|
||||
)),
|
||||
registrar = new ExtensionRegistrar(
|
||||
app,
|
||||
new CustomRegistrars(app, $log),
|
||||
$log
|
||||
),
|
||||
bootstrapper = new ApplicationBootstrapper(
|
||||
angular,
|
||||
window.document
|
||||
),
|
||||
initializer = new FrameworkInitializer(
|
||||
loader,
|
||||
resolver,
|
||||
registrar,
|
||||
bootstrapper
|
||||
);
|
||||
|
||||
$log.info("Initializing application.");
|
||||
initializer.runApplication(Constants.BUNDLE_LISTING_FILE);
|
||||
}
|
||||
|
||||
injector.invoke(['$http', '$log', initializeApplication]);
|
||||
}
|
||||
);
|
Loading…
Reference in New Issue
Block a user