2014-11-03 21:29:59 +00:00
|
|
|
/*global define,Promise*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Module defining FrameworkInitializer. Created by vwoeltje on 11/3/14.
|
|
|
|
*/
|
|
|
|
define(
|
|
|
|
[],
|
|
|
|
function () {
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
/**
|
2014-11-05 01:17:35 +00:00
|
|
|
* Responsible for managing the four stages of framework
|
|
|
|
* initialization:
|
|
|
|
*
|
|
|
|
* * Loading bundle metadata (JSON files)
|
|
|
|
* * Resolving extension implementations with Require
|
|
|
|
* * Registering extensions with Angular
|
|
|
|
* * Bootstrapping the Angular application.
|
2014-11-03 21:29:59 +00:00
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {BundleLoader} loader
|
2014-11-04 16:35:06 +00:00
|
|
|
* @param {BundleResolver} resolver
|
2014-11-03 21:29:59 +00:00
|
|
|
* @param {ExtensionRegistrar} registrar
|
|
|
|
* @param {ApplicationBootstrapper} bootstrapper
|
|
|
|
*/
|
|
|
|
function FrameworkInitializer(loader, resolver, registrar, bootstrapper) {
|
|
|
|
|
|
|
|
return {
|
|
|
|
runApplication: function (bundleList) {
|
2014-11-04 16:35:06 +00:00
|
|
|
return loader.loadBundles(bundleList)
|
|
|
|
.then(resolver.resolveBundles)
|
|
|
|
.then(registrar.registerExtensions)
|
2014-11-04 21:00:12 +00:00
|
|
|
.then(bootstrapper.bootstrap);
|
2014-11-03 21:29:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return FrameworkInitializer;
|
|
|
|
}
|
|
|
|
);
|