Defined in: packages/ember-pacer/src/async-throttler/useAsyncThrottler.ts:98
Creates and retains the AsyncThrottler for its Ember owner.
Limits execution to at most one call per wait interval. Leading and trailing options control immediate and deferred execution; the trailing call uses the latest arguments.
The callback may return a Promise. Core result, error, retry, and abort behavior is preserved. Use onSuccess, onError, and onSettled for execution outcomes.
Pass a selector to track only the state consumed by the owner. The default selection is {}, so utility state changes do not update the owner unless it opts in. Selection uses shallow comparison. The raw store remains available for additional subscriptions. The selector is the second positional argument. Read utility.state from the template. The contextual utility.Subscribe helper selects state for a child template.
Available state fields:
Tracked named arguments update options after rendering. createPacerScope supplies shared defaults through contextual helpers. Local named options override those defaults. Removing the helper invocation calls cancel() and abort(). onUnmount replaces default cleanup and receives the same adapter instance. A custom callback must perform all required cleanup. Use flush() where supported to finish pending work.
import { on } from '@ember/modifier'
import { fn } from '@ember/helper'
import { useAsyncThrottler } from '@tanstack/ember-pacer'
import type { AsyncThrottlerState } from '@tanstack/ember-pacer'
const select = (state: AsyncThrottlerState<(value: string) => Promise<void>>) => ({ isPending: state.isPending })
<template>
{{#let (useAsyncThrottler @process select wait=500) as |utility|}}
<button {{on "click" (fn utility.maybeExecute "item")}}>Schedule</button>
<span>{{utility.state.isPending}}</span>
{{/let}}
</template>TFn extends AnyAsyncFunction
TSelected = { }
new UseAsyncThrottler<TFn, TSelected>(owner?): UseAsyncThrottler;Defined in: node_modules/.pnpm/ember-source@7.3.0_@glimmer+component@2.1.1_supports-color@7.2.0__supports-color@7.2.0/node_modules/ember-source/types/stable/@ember/object/index.d.ts:28
Owner
UseAsyncThrottler
Helper<{
Args: {
Positional:
| [fn: TFn]
| [fn: TFn, selector: (state: AsyncThrottlerState<TFn>) => TSelected]
Named: EmberAsyncThrottlerOptions<TFn, TSelected>
}
Return: EmberAsyncThrottler<TFn, TSelected>
}>.constructorcompute(positional, options): EmberAsyncThrottler<TFn, TSelected>;Defined in: packages/ember-pacer/src/async-throttler/useAsyncThrottler.ts:118
Override this function when writing a class-based helper.
[TFn, (state) => TSelected]
The positional arguments to the helper
EmberAsyncThrottlerOptions<TFn, TSelected>
EmberAsyncThrottler<TFn, TSelected>
compute
1.13.0
Helper.compute