dynamic-forms / Function

createDebouncedSignal

Generic types:T

Creates a debounced signal that emits values from the source signal only after the value has stabilized for the specified duration.

Unlike createDebouncedEffect, this doesn't execute a side effect callback. Use this when you just need a debounced version of a signal.

Presentation

function createDebouncedSignal(
  source: Signal<T>,
  options: { ms?: number | undefined; injector: Injector },
): Signal<T | undefined>;

Returns

Signal<T | undefined> -

A signal that emits the debounced value

Parameters

NameTypeDescription
source
Signal<T>

The source signal to debounce

options
{ ms?: number | undefined; injector: Injector; }

Configuration options

Example usage

const input = signal('');
const debouncedInput = createDebouncedSignal(input, { ms: 300, injector });

effect(() => {
  console.log('Debounced value:', debouncedInput());
});