function injectAsyncBatcher<TValue>(fn, options?): AngularAsyncBatcher<TValue>;Defined in: packages/angular-pacer/src/async-batcher/injectAsyncBatcher.ts:104
Creates and manages an Angular AsyncBatcher in the current injection context.
Collects items and processes each batch asynchronously when its size or delay threshold is reached.
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 batches and abort running work. Set onUnmount to replace it.
TValue
(items) => Promise<any>
The callback invoked by the core utility.
MaybeAccessor<AngularAsyncBatcherOptions<TValue>>
Core options or a reactive factory returning them.
AngularAsyncBatcher<TValue>
A ref containing stable methods and a readonly selected-state signal.
// In a component or service injection context.
const utility = injectAsyncBatcher(
(items: Array<string>) => Promise.resolve(items),
() => ({ maxSize: 10, wait: 100 }),
(state) => state.isPending,
)
utility.addItem('job')
console.log(utility.state())function injectAsyncBatcher<TValue, TSelected>(
fn,
options,
selector): AngularAsyncBatcher<TValue, TSelected>;Defined in: packages/angular-pacer/src/async-batcher/injectAsyncBatcher.ts:115
Creates an Angular AsyncBatcher with a reactive selector result.
TValue
TSelected
(items) => Promise<any>
The callback invoked by the core utility.
MaybeAccessor<AngularAsyncBatcherOptions<TValue>>
Core options or a reactive options factory.
(state) => TSelected
Selects the state exposed by the returned state signal.
AngularAsyncBatcher<TValue, TSelected>
The utility ref with the selected state.