@rxx/worker
Version:
React MVI micro framework.
41 lines (40 loc) • 1.01 kB
TypeScript
/**
* @fileoverview
* @author Taketoshi Aono
*/
import { Observable } from 'rxjs';
export interface SubjectPayload<Type extends string, Payload, States = {}> {
type: Type;
states: States;
payload: Payload;
dispatch(key: string, args: any): void;
}
export declare class SubjectTree {
private subject;
private state;
private preservation;
private shouldImmediateDispatch;
private lastDispatched;
private histories;
private subscribers;
setState(state: any): void;
subscribe(callback: (a: {
type: string;
payload: any;
}) => void): void;
unsubscribe(callback: any): void;
unsubscribeAll(): void;
notify<Payload>(payload: {
type: string;
payload: Payload;
}): void;
readonly observable: Observable<any>;
getLastDispatched(): {
type: string;
payload: any;
} | null;
private notifySubscribers;
private doNotify;
private findHistory;
private createSubjectPayload;
}