UNPKG

mobx-keystone

Version:

A MobX powered state management solution based on data trees with first class support for TypeScript, snapshots, patches and much more

19 lines (18 loc) 706 B
import { ActionMiddlewareDisposer } from '../action/middleware'; import { AnyModel } from '../model/BaseModel'; /** * Creates a transaction middleware, which reverts changes made by an action / child * actions when the root action throws an exception by applying inverse patches. * * @template M Model * @param target Object with the root target model object (`model`) and root action name (`actionName`). * @returns The middleware disposer. */ export declare function transactionMiddleware<M extends AnyModel>(target: { model: M; actionName: keyof M; }): ActionMiddlewareDisposer; /** * Transaction middleware as a decorator. */ export declare function transaction(...args: any[]): void;