UNPKG

berish-stober

Version:

Библиотека расширенного манипулирования хранилищем. Позволяет расширять функционал хранения данных посредством специальных обработчиков

18 lines (17 loc) 961 B
import { IAction, Store } from './store'; export declare type IMethodReducer<State, TStore extends DynamicStore<State>> = (store: TStore, state: State, action: IAction) => TStore | void; export declare type IMethodReducerAsync<State, TStore extends DynamicStore<State>> = (store: TStore, state: State, action: IAction) => Promise<TStore> | Promise<void>; export interface IMethodAction<State, TStore extends DynamicStore<State>> extends IAction { reducer: IMethodReducer<State, TStore>; } export declare class DynamicStore<State = any> extends Store<State> { private methodAction; private changesUnlistener; isMethodAction(action: IAction): action is IMethodAction<State, this>; methodReduce(state: State, action: IAction): State; create(methodReducer: IMethodReducer<State, this>): IMethodAction<State, this>; loadState(): Promise<State>; changesStart(): void; changesStop(): void; protected storeInitialized(): void; }