react-model
Version:
The State management library for React
30 lines (29 loc) • 1.21 kB
TypeScript
/// <reference types="react" />
import Global from './global';
declare const GlobalContext: import("react").Context<{
[modelName: string]: any;
}>;
declare const Consumer: import("react").Consumer<{
[modelName: string]: any;
}>;
declare const consumerActions: (actions: Actions, modelContext: {
modelName: string;
}) => any;
declare const setPartialState: (name: keyof typeof Global['State'], partialState: {
[modelName: string]: any;
} | ((state: typeof Global['State']['name']) => void)) => {
[modelName: string]: any;
};
declare const get: <T>(p: Array<string | number>) => (o: T) => any;
declare const timeout: <T>(ms: number, data: T) => Promise<T>;
declare const getInitialState: <T extends {
modelName: string | string[];
}>(context?: T | undefined, config?: {
isServer?: boolean | undefined;
prefix?: string | undefined;
} | undefined) => Promise<{
[modelName: string]: any;
}>;
declare const getCache: (modelName: string, actionName: string) => any;
declare const shallowEqual: (objA: any, objB: any) => boolean;
export { Consumer, consumerActions, GlobalContext, setPartialState, shallowEqual, timeout, get, getCache, getInitialState };