import type { Store as ReduxStore } from 'redux'; import EventEmitter from 'eventemitter3'; import type { ReactReduxContext } from 'react-redux'; export type Store = any; export type RefluxActions = Record; export declare function isReduxStore(store: Store): store is ReduxStore; export interface Plugin { /** * Redux or reflux store that will be automatically passed to a * corresponding provider */ store: Store; /** * Optional, only relevant for plugins using redux stores in cases where * exposed plugin methods need access to plugin store in react tree where * another redux store is mounted */ context?: typeof ReactReduxContext; /** * Optional, only relevant for plugins still using reflux */ actions?: RefluxActions; /** * Will be called to clean up plugin subscriptions when it is deactivated by * app registry scope */ deactivate: () => void; } /** * Is a registry for all user interface components, stores, and actions * in the application. */ export declare class AppRegistry { _emitter: EventEmitter; plugins: Record; /** * Instantiate the registry. */ constructor(); static get AppRegistry(): typeof AppRegistry; deregisterPlugin(name: string): this; getPlugin(name: string): Plugin | undefined; registerPlugin(name: string, plugin: Plugin): this; deactivate(): void; /** * Adds a listener for the event name to the underlying event emitter. * * @param {String} eventName - The event name. * @param {Function} listener - The listener. * * @returns {AppRegistry} The chainable app registry. */ addListener(eventName: string, listener: (...args: any[]) => void): this; /** * Emits an event for the name with the provided arguments. * * @param {String} eventName - The event name. * @param {...Object} args - The arguments. * * @returns {Boolean} If the event had listeners. */ emit(eventName: string, ...args: any[]): boolean; /** * Return all the event names. * * @returns {Array} The event names. */ eventNames(): string[]; /** * Gets a count of listeners for the event name. * * @param {String} eventName - The event name. * * @returns {Number} The listener count. */ listenerCount(eventName: string): number; /** * Get all the listeners for the event. * * @param {String} eventName - The event name. * * @returns {Array} The listeners for the event. */ listeners(eventName: string): ((...args: any[]) => void)[]; /** * Adds a listener for the event name to the underlying event emitter. * * @param {String} eventName - The event name. * @param {Function} listener - The listener. * * @returns {AppRegistry} The chainable app registry. */ on(eventName: string, listener: (...args: any[]) => void): this; /** * Adds a listener for the event name to the underlying event emitter * to handle an event only once. * * @param {String} eventName - The event name. * @param {Function} listener - The listener. * * @returns {AppRegistry} The chainable app registry. */ once(eventName: string, listener: (...args: any[]) => void): this; /** * Removes a listener for the event. * * @param {String} eventName - The event name. * @param {Function} listener - The listener. * * @returns {AppRegistry} The chainable app registry. */ removeListener(eventName: string, listener: (...args: any[]) => void): this; /** * Removes all the listeners for the event name. * * @param {String} eventName - The event name. * * @returns {AppRegistry} The chainable app registry. */ removeAllListeners(eventName: string): this; } /** * Create a global app registry and prevent modification. */ export declare const globalAppRegistry: Readonly; //# sourceMappingURL=app-registry.d.ts.map