anystatejs
Version:
javascript state handler
21 lines (20 loc) • 830 B
TypeScript
import { Subscribable, Observable } from 'rxjs';
export declare class StateManager<TState> implements Subscribable<TState> {
private initialValue;
private state$;
private childrenSubscriptions;
private actions;
get subscribe(): any;
get value(): TState;
constructor(initialValue: TState);
set(value: TState): void;
reset(): void;
update<TPartial>(partialValue: TPartial): void;
getPropertyObservable<TProperty>(key: string): Observable<TProperty>;
call(name: string, ...inputs: any[]): void;
createAction<TPartial>(name: string, action: (state: TState, ...inputs: any[]) => TPartial): void;
removeAction(name: string): void;
createChild<TChild>(key: string): StateManager<TChild>;
removeChild(key: string): void;
removeAllChildren(): void;
}