UNPKG

mst-effect

Version:

Designed to be used with MobX-State-Tree to create asynchronous actions using RxJS.

7 lines 775 B
import { Observable } from 'rxjs'; import type { AnyInstance, IsEmptyPayload, PayloadFunc } from '../types'; import type { ValidEffectActions } from './action'; export declare type DollEffectFactory<P, R = void> = (payload$: Observable<P>, dollSignal: PayloadFunc<R, void>) => Observable<ValidEffectActions>; export declare type DollEffectDispatcher<P, R> = IsEmptyPayload<P> extends true ? <T = R>(payload?: undefined, handler?: (result$: Observable<R>) => Observable<T>) => Promise<T | undefined> : <T = R>(payload: P, handler?: (result$: Observable<R>) => Observable<T>) => Promise<T | undefined>; export declare function dollEffect<P, R = unknown>(self: AnyInstance, factory: DollEffectFactory<P, R>): DollEffectDispatcher<P, R>; //# sourceMappingURL=doll-effect.d.ts.map