react-terrific-bridge
Version:
A utility belt for using TerrificJS together with React. Provides module registration and unregistration as well as an action API for event bindings, also supporting Flow and TypeScript.
58 lines (45 loc) • 1.63 kB
Flow
declare module "react-terrific-bridge" {
declare class Component {
props: any,
state: any,
context: any,
static name: string,
constructor(props?: any, context?: any): any,
setState(partial: any, callback?: any): void,
forceUpdate(callback?: any): void
}
declare export type TerrificApp = {
_config: Object,
_ctx: Object,
_id: number,
_modules: Object,
_sandbox: Object,
start: Function,
getModuleById: Function,
registerModule: Function,
unregisterModules: Function
};
declare export type TerrificSandbox = {
_application: TerrificApp,
_eventEmitters: Array<Object>
};
declare export var TerrificBridgeGlobalAppId: string;
declare export type TerrificBridgeFnFactory = {
[action: string]: Function
};
declare export function getGlobalApp(): TerrificBridge | void;
declare export class TerrificBridge {
app: TerrificApp,
config: Object,
terrific: Object,
constructor(debug: Boolean): TerrificBridge,
configure(config?: Object): void,
load(config?: Object): void,
reset(): void,
getComponentById(componentId: number): Object | null,
registerComponent(component: Component<*, *, *>, compositeFactory?: TerrificBridgeFnFactory): Object | void,
unregisterComponent(component: Component<*, *, *>): boolean,
action(component: Component<*, *, *>, action: string, ...args: any): boolean | void
}
declare export default TerrificBridge
}