diff --git a/platform/framework/src/Main.js b/platform/framework/src/Main.js index e767b4070a..51ccdba443 100644 --- a/platform/framework/src/Main.js +++ b/platform/framework/src/Main.js @@ -80,6 +80,9 @@ define( initializer.runApplication(Constants.BUNDLE_LISTING_FILE); } + // Reconfigure base url, since bundle paths will all be relative + // to the root now. + requirejs.config({ "baseUrl": "" }); injector.invoke(['$http', '$log', initializeApplication]); } ); \ No newline at end of file diff --git a/platform/framework/src/register/CustomRegistrars.js b/platform/framework/src/register/CustomRegistrars.js index 315101490c..9c3fc0a225 100644 --- a/platform/framework/src/register/CustomRegistrars.js +++ b/platform/framework/src/register/CustomRegistrars.js @@ -49,6 +49,29 @@ define( }; } + function registerConstant(extension) { + var key = extension.key, + value = extension.value; + + if (typeof key === "string" && value !== undefined) { + $log.info([ + "Registering constant: ", + key, + " with value ", + value + ].join("")); + app.constant(key, value); + } else { + $log.warn([ + "Cannot register constant ", + key, + " with value ", + value + ].join("")); + } + + } + // Custom registration function for extensions of category "route" function registerRoute(extension) { var route = Object.create(extension); @@ -93,6 +116,7 @@ define( // name of the extension category to be handled, and the value // is the function which handles it. return { + constants: mapUpon(registerConstant), routes: mapUpon(registerRoute), directives: mapUpon(new CustomRegistrar("directive")), controllers: mapUpon(new CustomRegistrar("controller")), diff --git a/platform/framework/src/register/ExtensionRegistrar.js b/platform/framework/src/register/ExtensionRegistrar.js index c812a1249a..2ca1b9feca 100644 --- a/platform/framework/src/register/ExtensionRegistrar.js +++ b/platform/framework/src/register/ExtensionRegistrar.js @@ -156,6 +156,9 @@ define( } function registerExtensionGroup(extensionGroup) { + // Announce we're entering a new phase + $log.info("Registering extensions..."); + // Register all declared extensions by category Object.keys(extensionGroup).forEach(function (category) { registerExtensionsForCategory( diff --git a/platform/framework/src/register/PartialConstructor.js b/platform/framework/src/register/PartialConstructor.js index 3ab52ac784..e290a3a947 100644 --- a/platform/framework/src/register/PartialConstructor.js +++ b/platform/framework/src/register/PartialConstructor.js @@ -26,10 +26,10 @@ define( */ function PartialConstructor(Constructor) { - return function () { // Bind services + function OuterConstructor() { // Bind services var dependencies = Array.prototype.slice.call(arguments); - return function () { // Bind everything else + function InnerConstructor() { // Bind everything else var other = Array.prototype.slice.call(arguments), instance = Object.create(Constructor.prototype); @@ -41,7 +41,16 @@ define( return instance; }; + + // Copy properties from original constructor + Object.keys(Constructor).forEach(function (k) { + InnerConstructor[k] = Constructor[k]; + }); + + return InnerConstructor; }; + + return OuterConstructor; } return PartialConstructor; diff --git a/platform/framework/src/resolve/ExtensionResolver.js b/platform/framework/src/resolve/ExtensionResolver.js index 4c686355e1..29713055a7 100644 --- a/platform/framework/src/resolve/ExtensionResolver.js +++ b/platform/framework/src/resolve/ExtensionResolver.js @@ -31,12 +31,21 @@ define( } : Object.create(impl); - Object.keys(definition).forEach(function (k) { - result[k] = definition[k]; + // Copy over static properties + Object.keys(impl).forEach(function (k) { + result[k] = impl[k]; }); + // Copy over definition + Object.keys(definition).forEach(function (k) { + if (result[k] === undefined) { + result[k] = definition[k]; + } + }); + result.definition = definition; + // Log that this load was successful - $log.info("Loaded " + extension.getLogName()); + $log.info("Resolved " + extension.getLogName()); return result; }