@player-ui/player
Version:
32 lines • 1.3 kB
TypeScript
import type { ViewPlugin, Resolver, ViewInstance } from "../../view";
import type { BindingInstance, BindingFactory } from "../../binding";
export interface BindingTracker {
/** Get the bindings currently being tracked for validation */
getBindings(): Set<BindingInstance>;
/** Add a binding to the tracked set */
trackBinding(binding: BindingInstance): void;
}
interface Options {
/** Parse a binding from a view */
parseBinding: BindingFactory;
/** Callbacks when events happen */
callbacks?: {
/** Called when a binding is encountered for the first time in a view */
onAdd?: (binding: BindingInstance) => void;
};
}
/** A view plugin that manages bindings tracked across updates */
export declare class ValidationBindingTrackerViewPlugin implements ViewPlugin, BindingTracker {
private options;
private trackedBindings;
constructor(options: Options);
/** Fetch the tracked bindings in the current view */
getBindings(): Set<BindingInstance>;
/** Add a binding to the tracked set */
trackBinding(binding: BindingInstance): void;
/** Attach hooks to the given resolver */
applyResolver(resolver: Resolver): void;
apply(view: ViewInstance): void;
}
export {};
//# sourceMappingURL=binding-tracker.d.ts.map