UNPKG

@rxx/core

Version:

React MVI micro framework.

34 lines (33 loc) 1.39 kB
import { Subscription } from 'rxjs'; import { Handler, StreamStore, HandlerResponse, CutPoints, Advices } from './handler'; import { IntentHandler } from '../intent/intent-handler'; import { SubjectTree } from '../subject'; export declare type StateHandlerMap = { [key: string]: Handler; }; export declare function getHandlers(): StateHandlerMap; export declare function registerHandlers(newHandlers: StateHandlerMap): { [key: string]: HandlerResponse; }; export declare function removeHandler(key: string | string[]): void; export declare abstract class StateHandler implements Handler { protected readonly store: StreamStore; private readonly handlerResponse; private intentHandler; protected state: any; protected subject: SubjectTree; protected advices: Advices; protected cutPoints: CutPoints; setState(state: any): void; setIntent(intent: IntentHandler): void; setSubject(subject: SubjectTree): void; readonly intent: IntentHandler; constructor(advices?: Advices, cutPoints?: CutPoints); abstract subscribe(props: { [key: string]: any; }): Subscription; abstract clone<T = Handler>(...args: any[]): Handler; readonly response: HandlerResponse; abstract push(key: string, args?: any): any; callback<Args = any, ReturnType = any>(key: string, value?: any): (args?: Args) => Promise<ReturnType>; }