[Framework] Add extension sorter

Add priority ordering to loaded extensions in each category;
this allows control over the resulting order of extensions
acquired and used within the application. WTD-590
This commit is contained in:
Victor Woeltjen
2015-01-07 16:39:57 -08:00
parent 2bcb6a1a6e
commit 9d8885d48f
4 changed files with 129 additions and 18 deletions

View File

@@ -17,9 +17,11 @@ define(
* @param {Object.<string,function>} customRegistrars an object
* containing custom registration functions, primarily for
* Angular built-ins.
* @param {ExtensionSorter} sorter the sorter which will impose
* priority ordering upon extensions
* @param {*} $log Angular's logging service
*/
function ExtensionRegistrar(app, customRegistrars, $log) {
function ExtensionRegistrar(app, customRegistrars, sorter, $log) {
// Track which extension categories have already been registered.
// Exceptions will be thrown if the same extension category is
// registered twice.
@@ -163,7 +165,7 @@ define(
Object.keys(extensionGroup).forEach(function (category) {
registerExtensionsForCategory(
category,
extensionGroup[category]
sorter.sort(extensionGroup[category])
);
});