function injectAsyncDebouncer<TFn>(fn, options): AngularAsyncDebouncer<TFn>;Defined in: packages/angular-pacer/src/async-debouncer/injectAsyncDebouncer.ts:103
Creates and manages an Angular AsyncDebouncer in the current injection context.
Waits until calls stop for the configured delay, then runs the latest asynchronous callback.
Accepts static options or an options factory. Factories are read lazily, and signal dependencies update the existing core instance. Local options override provider defaults. Methods apply current options before executing and schedule work outside Angular's zone. The provided function runs inside Angular's zone.
Pass a selector to expose reactive core state through state(). Without a selector, state() returns {}; operations remain available on the ref.
The default cleanup is to cancel pending execution and abort running work. Set onUnmount to replace it.
TFn extends AnyAsyncFunction
TFn
The callback invoked by the core utility.
MaybeAccessor<AngularAsyncDebouncerOptions<TFn>>
Core options or a reactive factory returning them.
A ref containing stable methods and a readonly selected-state signal.
// In a component or service injection context.
const utility = injectAsyncDebouncer(
(query: string) => Promise.resolve(query),
() => ({ wait: 250 }),
(state) => state.isPending,
)
utility.maybeExecute('search')
console.log(utility.state())function injectAsyncDebouncer<TFn, TSelected>(
fn,
options,
selector): AngularAsyncDebouncer<TFn, TSelected>;Defined in: packages/angular-pacer/src/async-debouncer/injectAsyncDebouncer.ts:114
Creates an Angular AsyncDebouncer with a reactive selector result.
TFn extends AnyAsyncFunction
TSelected
TFn
The callback invoked by the core utility.
MaybeAccessor<AngularAsyncDebouncerOptions<TFn>>
Core options or a reactive options factory.
(state) => TSelected
Selects the state exposed by the returned state signal.
AngularAsyncDebouncer<TFn, TSelected>
The utility ref with the selected state.