1 |
|
2 | import { Reducer } from "./types";
|
3 | export interface Store<S> {
|
4 | useState(nextObserveState?: (keyof S)[]): S;
|
5 | useDispatch(): (action: any, callback?: () => void) => void;
|
6 | persist(state: S, action: {
|
7 | type: any;
|
8 | }): void;
|
9 | setToState(): Promise<void>;
|
10 | dispatch: (action: any, callback?: () => void) => void;
|
11 | state: S;
|
12 | }
|
13 | export interface PrivateStore<S> extends Store<S> {
|
14 | stateContext: React.Context<S>;
|
15 | dispatchContext: React.Context<(action: any, callback?: () => void) => void>;
|
16 | reducer: Reducer<S>;
|
17 | initialState: S;
|
18 | persistKey: string;
|
19 | }
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | export declare const createStore: <T extends {
|
25 | [x: string]: any;
|
26 | }>({ reducer, initialState, mapStateToPersist, storage, persistKey, }: {
|
27 | reducer: Reducer<T, import("./types").Action<T>>;
|
28 | initialState: T;
|
29 | storage: any;
|
30 | persistKey: string;
|
31 | mapStateToPersist?: ((state: T) => Partial<T>) | undefined;
|
32 | }) => Store<T>;
|
33 |
|
\ | No newline at end of file |