UNPKG

proxy-state-tree

Version:

An implementation of the Mobx/Vue state tracking approach, for library authors

43 lines (42 loc) 1.85 kB
import { MutationTree } from './MutationTree'; import { IS_PROXY, PATH, PROXY_TREE, VALUE } from './Proxyfier'; import { TrackStateTree } from './TrackStateTree'; import { IFlushCallback, IMutation, IMutationCallback, IMutationTree, IOptions, IProxifier, IProxyStateTree, ITrackCallback, ITrackStateTree, TTree } from './types'; export { IS_PROXY, PROXY_TREE, VALUE, PATH, IMutation, ITrackCallback, ITrackStateTree, IMutationTree, TrackStateTree, MutationTree, }; export * from './types'; export declare class ProxyStateTree<T extends object> implements IProxyStateTree<T> { flushCallbacks: IFlushCallback[]; mutationCallbacks: IMutationCallback[]; currentFlushId: number; currentTree: TTree; previousTree: TTree; mutationTree: IMutationTree<T>; proxifier: IProxifier<T>; root: ProxyStateTree<T>; pathDependencies: { [path: string]: Set<ITrackCallback>; }; state: T; sourceState: T; options: IOptions; constructor(state: T, options?: IOptions); private createTrackStateProxifier; getMutationTree(): IMutationTree<T>; getTrackStateTree(): ITrackStateTree<T>; getTrackStateTreeWithProxifier(): ITrackStateTree<T>; setTrackStateTree(tree: ITrackStateTree<T>): void; unsetTrackStateTree(tree: ITrackStateTree<T>): void; clearTrackStateTree(): void; disposeTree(tree: IMutationTree<T> | ITrackStateTree<T>): void; onMutation(callback: IMutationCallback): () => void; forceFlush(): void; flush(trees: any, isAsync?: boolean): { mutations: any; flushId: number; }; onFlush(callback: IFlushCallback): () => IFlushCallback[]; rescope(value: any, tree: TTree): any; addPathDependency(path: string, callback: ITrackCallback): void; removePathDependency(path: string, callback: ITrackCallback): void; toJSON(): T; }