UNPKG

1.28 kBTypeScriptView Raw
1import { IMiddlewareEvent } from "../core/action";
2export interface IMiddleWareApi {
3 getState: () => any;
4 dispatch: (action: any) => void;
5}
6export interface IReduxStore extends IMiddleWareApi {
7 subscribe(listener: (snapshot: any) => void): any;
8}
9export declare type MiddleWare = (middlewareApi: IMiddleWareApi) => ((next: (action: IMiddlewareEvent) => void) => void);
10/**
11 * Creates a tiny proxy around a MST tree that conforms to the redux store api.
12 * This makes it possible to use MST inside a redux application.
13 *
14 * See the [redux-todomvc example](https://github.com/mobxjs/mobx-state-tree/blob/e9e804c8c43e1edde4aabbd52675544e2b3a905b/examples/redux-todomvc/src/index.js#L20) for more details.
15 *
16 * @export
17 * @param {*} model
18 * @param {...MiddleWare[]} middlewares
19 * @returns {IReduxStore}
20 */
21export declare function asReduxStore(model: any, ...middlewares: MiddleWare[]): IReduxStore;
22/**
23 * Connects a MST tree to the Redux devtools.
24 * See this [example](https://github.com/mobxjs/mobx-state-tree/blob/e9e804c8c43e1edde4aabbd52675544e2b3a905b/examples/redux-todomvc/src/index.js#L21) for a setup example.
25 *
26 * @export
27 * @param {*} remoteDevDep
28 * @param {*} model
29 */
30export declare function connectReduxDevtools(remoteDevDep: any, model: any): void;