mirror of
https://github.com/nasa/openmct.git
synced 2024-12-18 20:57:53 +00:00
[Selection] Allow providers to return array
...to allow one-to-many providers for actions, as is useful for Create et al (and, in this specific case, to support adapters.)
This commit is contained in:
parent
9e19296b14
commit
8dfa8df28a
@ -6,10 +6,14 @@ define([], function () {
|
||||
ActionRegistry.prototype.get = function (context) {
|
||||
return this.providers.filter(function (provider) {
|
||||
return provider.appliesTo(context);
|
||||
});
|
||||
}).map(function (provider) {
|
||||
return provider.get(context);
|
||||
}).reduce(function (a, b) {
|
||||
return Array.isArray(b) ? a.concat(b) : a.concat([b]);
|
||||
}, []);
|
||||
};
|
||||
|
||||
ActionRegistry.prototype.addProvider = function (provider) {
|
||||
ActionRegistry.prototype.register = function (provider) {
|
||||
this.providers.push(provider);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user