kex
Version:
Kex is a tiny library for state managenent in JavaScript projects
28 lines (27 loc) • 1.04 kB
TypeScript
import { KxAction } from './action';
import { KxResolvedModifier } from './resolved-modifier';
import { KxReducer } from './reducer';
import { KxListener } from './listener';
import { KxChange } from './change';
import { KxState } from './state';
export declare class KxStore {
private _reducers;
private _listeners;
private _state;
private _historyMaxSize;
private _history;
constructor();
private _broadcastChange;
history(): KxChange[];
getState<T>(): KxState<T>;
getCache<T>(key: string, token?: any): null | T;
setCache<T>(key: string, value: any, token?: any): Partial<T>;
update<T>(resolvedModifier: KxResolvedModifier<KxState<T>>): KxState<T>;
clear<T>(): KxState<T>;
clearCache<T>(): KxState<T>;
replaceReducers(...nextReducers: KxReducer<any>[]): KxStore;
addStorageListener(listener: KxListener): KxStore;
removeStorageListener(listener: KxListener): KxStore;
dispatch<T>(action: KxAction): Promise<KxState<T>>;
setHistoryMaxSize(size: number): void;
}