UNPKG

@rxx/core

Version:

React MVI micro framework.

45 lines (44 loc) 1.57 kB
import { Observable, Subject, Subscription } from 'rxjs'; import { StreamCollection } from './stream-collection'; import { Advice, AdviceFunction } from './advice'; import { IntentHandler } from '../intent/intent-handler'; import { SubjectTree } from '../subject'; export declare class HandlerResponse { private streamCollection; constructor(streamCollection: StreamCollection); for<T, V>(key: string): Observable<StateHandlerData<T, V>>; } export declare class StreamStore implements StreamCollection { private subjectMap; constructor(subjectMap?: { [key: string]: Subject<any>; }); hasWithoutGlobal(key: string): boolean; has(key: string): boolean; getWithoutGlobal(key: string): Subject<any>; get(keySpace: string, create?: boolean): Subject<any>[]; add<T>(key: string): Subject<T>; } export interface Handler { response: HandlerResponse; subscribe(props: { [key: string]: any; }): Subscription; push(key: string, args?: any): Promise<any>; callback<Args, ReturnType>(key: string, value?: any): (args?: Args) => Promise<ReturnType>; setState(state: any): void; setSubject(subject: SubjectTree): void; setIntent(intent: IntentHandler): void; clone<T = Handler>(...args: any[]): Handler; readonly intent: IntentHandler; } export declare type Advices = { [key: string]: Advice | AdviceFunction; }; export declare type CutPoints = { [key: string]: string | string[]; }; export declare type StateHandlerData<Value, State> = { data: Value; state: State; };