UNPKG

@bloc-js/react-bloc

Version:

React components for implementing the BLoC pattern.

16 lines (15 loc) 678 B
import { Bloc } from "@bloc-js/bloc"; export declare class BlocRegistry { constructor(initialState?: { [id: string]: any; }); private blocs; private initialState; getState(): {}; register<S>(id: string, factory: TBlocFactory<S>, args: any[]): Bloc<S>; complete(id: string): void; } export declare type TBlocFactory<S> = (r: BlocRegistry, is?: S, ...args: any[]) => Bloc<S>; export declare type BlocGetter<S> = (registry: BlocRegistry, ...args: any[]) => Bloc<S>; export declare type BlocCompleter = (registry: BlocRegistry) => void; export declare function blocGetter<S>(id: string, factory: TBlocFactory<S>): [BlocGetter<S>, BlocCompleter];