UNPKG

2.07 kBTypeScriptView Raw
1/// <reference types="react" />
2import { Store as RefluxStore } from 'reflux';
3import EventEmitter from 'eventemitter3';
4import { Actions } from './actions';
5interface Role {
6 name: string;
7 component: React.JSXElementConstructor<unknown>;
8 order?: number;
9}
10interface Store extends RefluxStore {
11 onActivated?: (appRegistry: AppRegistry) => void;
12}
13export declare class AppRegistry {
14 _emitter: EventEmitter;
15 actions: Record<string, unknown>;
16 components: Record<string, React.JSXElementConstructor<unknown>>;
17 stores: Record<string, Store>;
18 roles: Record<string, Role[]>;
19 storeMisses: Record<string, number>;
20 constructor();
21 static get Actions(): typeof Actions;
22 static get AppRegistry(): typeof AppRegistry;
23 deregisterAction(name: string): this;
24 deregisterComponent(name: string): this;
25 deregisterRole(name: string, object: Role): this;
26 deregisterStore(name: string): this;
27 getAction(name: string): unknown;
28 getComponent(name: string): React.JSXElementConstructor<unknown> | undefined;
29 getRole(name: string): Role[] | undefined;
30 getStore(name: string): Store;
31 onActivated(): this;
32 registerAction(name: string, action: unknown): this;
33 registerComponent(name: string, component: React.JSXElementConstructor<unknown>): this;
34 registerRole(name: string, role: Role): this;
35 registerStore(name: string, store: Store): this;
36 addListener(eventName: string, listener: (...args: any[]) => void): this;
37 emit(eventName: string, ...args: any[]): boolean;
38 eventNames(): string[];
39 listenerCount(eventName: string): number;
40 listeners(eventName: string): ((...args: any[]) => void)[];
41 on(eventName: string, listener: (...args: any[]) => void): this;
42 once(eventName: string, listener: (...args: any[]) => void): this;
43 removeListener(eventName: string, listener: (...args: any[]) => void): this;
44 removeAllListeners(eventName: string): this;
45 _callOnStores(fn: (store: Store) => void): this;
46 _roleComparator(a: Role, b: Role): number;
47}
48export {};