@rxx/worker
Version:
React MVI micro framework.
44 lines (43 loc) • 1.53 kB
TypeScript
import { Observable, Subject, Subscription } from 'rxjs';
import { StreamCollection } from './stream-collection';
import { Advice, AdviceFunction, IntentCallback } from './advice';
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: IntentCallback): void;
clone<T = Handler>(...args: any[]): Handler;
readonly intent: IntentCallback;
}
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;
};