compote-ui
Version:
An opinionated UI component library for Svelte, built on top of [Ark UI](https://ark-ui.com) with additional components and features not available in the core Ark UI library.
17 lines (16 loc) • 836 B
TypeScript
export declare class DebouncedFilterEdits<T> {
#private;
constructor(delay?: number);
/** The pending edit for `id`, or undefined when there is none or it went stale. */
get(id: string, current: unknown): T | undefined;
/**
* Records an edit against the filter's `current` value: `update` receives the live
* pending edit (undefined when there is none or it went stale) and returns the new one.
* After the delay, `commit` runs with it — unless `read()` shows the filter changed.
*/
edit(id: string, current: unknown, update: (pending: T | undefined) => T, read: () => unknown, commit: (value: T) => void): void;
/** Drops the pending edit for `id` without committing it. */
cancel(id: string): void;
/** Drops every pending edit without committing. */
cancelAll(): void;
}