debouncedState

Category States

A reactive state that updates its value after a delay.

Demo

Search :

Usage

TIP

If you'd rather have them separate, check out debounce.

<script>
	import { debouncedState } from '@sv-use/core';
 
	const search = debouncedState('', { delay: 1000 });
</script>
Type definitions
type DebouncedStateOptions = {
    /** The delay in milliseconds before updating the state. */
    delay?: number;
};
/**
 * A reactive state that updates its value after a delay.
 * @param initial The initial value of the state.
 * @param options Additional options to customize the behavior.
 * @see https://svelte-librarian.github.io/sv-use/docs/core/states/debounced-state
 */
export declare function debouncedState<T>(initial: T, options?: DebouncedStateOptions): {
    current: T;
};
export {};

Sources