API/api.medcify.app/node_modules/fast-json-patch/commonjs/duplex.d.ts

24 lines
868 B
TypeScript
Raw Normal View History

2022-09-26 06:11:44 +00:00
import { Operation } from './core.js';
export interface Observer<T> {
object: T;
patches: Operation[];
unobserve: () => void;
callback: (patches: Operation[]) => void;
}
/**
* Detach an observer from an object
*/
export declare function unobserve<T>(root: T, observer: Observer<T>): void;
/**
* Observes changes made to an object, which can then be retrieved using generate
*/
export declare function observe<T>(obj: Object | Array<T>, callback?: (patches: Operation[]) => void): Observer<T>;
/**
* Generate an array of patches from an observer
*/
export declare function generate<T>(observer: Observer<Object>, invertible?: boolean): Operation[];
/**
* Create an array of patches from the differences in two objects
*/
export declare function compare(tree1: Object | Array<any>, tree2: Object | Array<any>, invertible?: boolean): Operation[];