Cleanup AppRegistry types
Summary: Found some missing/wrong types when playing around with the AppRegistry for routing work in the main app.
This commit is contained in:
parent
e073fdc4c7
commit
d6de865236
|
@ -22,9 +22,11 @@ if (__DEV__) {
|
||||||
|
|
||||||
var runnables = {};
|
var runnables = {};
|
||||||
|
|
||||||
|
type ComponentProvider = () => ReactClass<any, any, any>;
|
||||||
|
|
||||||
type AppConfig = {
|
type AppConfig = {
|
||||||
appKey: string;
|
appKey: string;
|
||||||
component: ReactClass<any, any, any>;
|
component?: ComponentProvider;
|
||||||
run?: Function;
|
run?: Function;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,12 +48,13 @@ var AppRegistry = {
|
||||||
if (appConfig.run) {
|
if (appConfig.run) {
|
||||||
AppRegistry.registerRunnable(appConfig.appKey, appConfig.run);
|
AppRegistry.registerRunnable(appConfig.appKey, appConfig.run);
|
||||||
} else {
|
} else {
|
||||||
|
invariant(appConfig.component, 'No component provider passed in');
|
||||||
AppRegistry.registerComponent(appConfig.appKey, appConfig.component);
|
AppRegistry.registerComponent(appConfig.appKey, appConfig.component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
registerComponent: function(appKey: string, getComponentFunc: Function): string {
|
registerComponent: function(appKey: string, getComponentFunc: ComponentProvider): string {
|
||||||
runnables[appKey] = {
|
runnables[appKey] = {
|
||||||
run: (appParameters) =>
|
run: (appParameters) =>
|
||||||
renderApplication(getComponentFunc(), appParameters.initialProps, appParameters.rootTag)
|
renderApplication(getComponentFunc(), appParameters.initialProps, appParameters.rootTag)
|
||||||
|
|
Loading…
Reference in New Issue