UNPKG

redux-providers

Version:

Minimalist dependency injection system for redux. Create providers to be injected and used in redux reducers.

18 lines 698 B
import { AnyAction, Dispatch } from 'redux'; export declare enum AsyncEventType { onStart = "onStart", onFinished = "onFinished", onSuccess = "onSuccess", onError = "onError" } export interface AsyncAction<PayloadType = any> extends AnyAction { eventType: AsyncEventType; payload?: PayloadType; error?: any; } export declare type AsyncActionFn = <PayloadType = any>(dispatch: Dispatch<AsyncAction<PayloadType>>) => void; export declare type AsyncStatusHandler<T> = { [K in AsyncEventType]?: (state: T) => T; }; export declare function handleAsyncAction<S>(state: S, action: AsyncAction, handler: AsyncStatusHandler<S>): S; //# sourceMappingURL=async-actions.d.ts.map