expose AppRegistry.getRegistry() for app specific handling

Summary: Add simple `getRegistry()` so that add can do some custom handling of the registered components, if appropriate.

Reviewed By: shergin

Differential Revision: D4550600

fbshipit-source-id: 367c66b9fddfe4cc81cbc32a7a6043215e0df666
This commit is contained in:
Kevin Gozali 2017-02-14 15:21:42 -08:00 committed by Facebook Github Bot
parent 67f6b32409
commit a86559ffb5
1 changed files with 11 additions and 0 deletions

View File

@ -43,6 +43,10 @@ type Runnable = {
type Runnables = {
[appKey: string]: Runnable,
};
type Registry = {
sections: Array<string>,
runnables: Runnables,
};
const runnables: Runnables = {};
let runCount = 1;
@ -128,6 +132,13 @@ const AppRegistry = {
return runnables[appKey];
},
getRegistry(): Registry {
return {
sections: AppRegistry.getSectionKeys(),
runnables: {...runnables},
};
},
runApplication(appKey: string, appParameters: any): void {
const msg =
'Running application "' + appKey + '" with appParams: ' +