ng-focus-apply
Version:
Simplify component interaction in angular with focus-apply pattern.
13 lines (12 loc) • 710 B
TypeScript
import { BehaviorSubject } from 'rxjs';
import { Observable } from 'rxjs';
export declare class FocusApplyStore<StoreModel> {
protected store: BehaviorSubject<StoreModel>;
state$: Observable<StoreModel>;
constructor(initialState: StoreModel);
apply: (...projections: ((state: StoreModel) => void)[]) => void;
applyAsync: <T>(obs: Observable<any>, ...projections: ((state: StoreModel, obsResult: T) => void)[]) => Observable<T>;
focus: <R>(projection: (value: StoreModel, index: number) => R) => Observable<R>;
focusAndSubscribe: <R>(projection: (value: StoreModel, index: number) => R, subscribeCallback: (result: R) => void) => this;
protected save(state: StoreModel): void;
}