import { IObservableWithChange, IReader } from "./base.js"; export interface IChangeTracker { createChangeSummary(previousChangeSummary: TChangeSummary | undefined): TChangeSummary; handleChange(ctx: IChangeContext, change: TChangeSummary): boolean; beforeUpdate?(reader: IReader, change: TChangeSummary): void; } export interface IChangeContext { readonly changedObservable: IObservableWithChange; readonly change: unknown; /** * Returns if the given observable caused the change. */ didChange(observable: IObservableWithChange): this is { change: TChange; }; } /** * Subscribes to and records changes and the last value of the given observables. * Don't use the key "changes", as it is reserved for the changes array! */ export declare function recordChanges>>(obs: TObs): IChangeTracker<{ [TKey in keyof TObs]: ReturnType; } & { changes: readonly ({ [TKey in keyof TObs]: { key: TKey; change: TObs[TKey]["TChange"]; }; }[keyof TObs])[]; }>; /** * Subscribes to and records changes and the last value of the given observables. * Don't use the key "changes", as it is reserved for the changes array! */ export declare function recordChangesLazy>>(getObs: () => TObs): IChangeTracker<{ [TKey in keyof TObs]: ReturnType; } & { changes: readonly ({ [TKey in keyof TObs]: { key: TKey; change: TObs[TKey]["TChange"]; }; }[keyof TObs])[]; }>;