mirror of
https://github.com/nasa/openmct.git
synced 2025-06-18 23:28:14 +00:00
[Framework] Change cardinality of custom registrars
Change cardinality of custom registrars from one to many; this will permit treating the service compositor as a custom registrar. WTD-518.
This commit is contained in:
@ -75,14 +75,22 @@ define(
|
|||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Utility; create a function which converts another function
|
||||||
|
// (which acts on single objects) to one which acts upon arrays.
|
||||||
|
function mapUpon(func) {
|
||||||
|
return function(array) {
|
||||||
|
return array.map(func);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// More like key-value pairs than methods; key is the
|
// More like key-value pairs than methods; key is the
|
||||||
// name of the extension category to be handled, and the value
|
// name of the extension category to be handled, and the value
|
||||||
// is the function which handles it.
|
// is the function which handles it.
|
||||||
return {
|
return {
|
||||||
routes: registerRoute,
|
routes: mapUpon(registerRoute),
|
||||||
directives: new CustomRegistrar("directive"),
|
directives: mapUpon(new CustomRegistrar("directive")),
|
||||||
controllers: new CustomRegistrar("controller"),
|
controllers: mapUpon(new CustomRegistrar("controller")),
|
||||||
services: new CustomRegistrar("service")
|
services: mapUpon(new CustomRegistrar("service"))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ define(
|
|||||||
// code for services, directives, etc; otherwise,
|
// code for services, directives, etc; otherwise,
|
||||||
// just register them under generic names.
|
// just register them under generic names.
|
||||||
if (customRegistrars[category]) {
|
if (customRegistrars[category]) {
|
||||||
extensions.forEach(customRegistrars[category]);
|
customRegistrars[category](extensions);
|
||||||
} else {
|
} else {
|
||||||
extensions.forEach(registerExtension);
|
extensions.forEach(registerExtension);
|
||||||
registerExtensionArraysForCategory(category, names);
|
registerExtensionArraysForCategory(category, names);
|
||||||
|
Reference in New Issue
Block a user