UNPKG

@player-ui/player

Version:

49 lines 2.56 kB
import type { BindingInstance } from "../binding"; import type { BatchSetTransaction, DataModelImpl, DataModelMiddleware, DataModelOptions, Updates } from "./model"; export type DependencySets = "core" | "children"; /** A class to track usage of read/writes to/from a data model */ export declare class DependencyTracker { protected readDeps: Set<BindingInstance>; protected writeDeps: Set<BindingInstance>; protected namedSet: DependencySets; private namedDependencySets; constructor(); protected createSubset(name: DependencySets, force?: boolean): void; /** Grab all of the bindings that this depended on */ getDependencies(name?: DependencySets): Set<BindingInstance>; trackSubset(name: DependencySets): void; trackDefault(): void; /** Grab all of the bindings this wrote to */ getModified(name?: DependencySets): Set<BindingInstance>; /** * Check to see if the dataModel has read the value at the given binding * * @param binding - The binding you want to check for */ readsBinding(binding: BindingInstance): boolean; /** * Check to see if the dataModel has written to the binding */ writesBinding(binding: BindingInstance): boolean; /** Reset all tracking of dependencies */ reset(): void; protected addReadDep(binding: BindingInstance, namedSet?: DependencySets): void; protected addWriteDep(binding: BindingInstance, namedSet?: DependencySets): void; addChildReadDep(binding: BindingInstance): void; } /** Middleware that tracks dependencies of read/written data */ export declare class DependencyMiddleware extends DependencyTracker implements DataModelMiddleware { constructor(); set(transaction: BatchSetTransaction, options?: DataModelOptions, next?: DataModelImpl | undefined): Updates; get(binding: BindingInstance, options?: DataModelOptions, next?: DataModelImpl | undefined): any; delete(binding: BindingInstance, options?: DataModelOptions, next?: DataModelImpl | undefined): void | undefined; } /** A data-model that tracks dependencies of read/written data */ export declare class DependencyModel<Options = DataModelOptions> extends DependencyTracker implements DataModelImpl<Options> { private readonly rootModel; constructor(rootModel: DataModelImpl<Options>); set(transaction: BatchSetTransaction, options?: Options): Updates; get(binding: BindingInstance, options?: Options): any; delete(binding: BindingInstance, options?: Options): void; } //# sourceMappingURL=dependency-tracker.d.ts.map