Defined in: packages/ember-pacer/src/rate-limiter/useRateLimitedValue.ts:55
Derives a rate-limited value from its current source.
Accepts updates while the configured limit has capacity in its fixed or sliding window. Rejected updates are discarded instead of delayed.
Yields an object with value, setValue, and utility. Read value in the template; utility exposes controls and selected state. Pass the current tracked value as the first positional argument. The initial value is available immediately. Source changes schedule updates on the existing utility.
The value updates independently of the utility selector. The default utility selection is {}. Pass a selector to subscribe to fields such as executionCount, isPending, or status where the underlying utility exposes them.
Invoke in a Glimmer template. Positional arguments provide the callback or value and optional selector. Named arguments provide options. Removing the invocation runs cleanup. Tracked named arguments refresh options after rendering. Local options override provider defaults without replacing the utility or its pending work. onUnmount replaces default cleanup and receives the utility instance. A custom callback must perform every needed cancel, stop, or abort action.
import { useRateLimitedValue } from '@tanstack/ember-pacer'
// Inside a component template:
<template>
{{#let (useRateLimitedValue @source limit=3 window=1000) as |result|}}
<output>{{result.value}}</output>
{{/let}}
</template>useRateLimiter
TValue
TSelected = { }
new UseRateLimitedValue<TValue, TSelected>(owner?): UseRateLimitedValue;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
UseRateLimitedValue
Helper<{
Args: {
Positional:
| [value: TValue]
| [value: TValue, selector: (state: RateLimiterState) => TSelected]
Named: EmberRateLimiterOptions<(value: TValue) => void, TSelected>
}
Return: EmberRateLimitedValue<TValue, TSelected>
}>.constructorcompute(positional, options): EmberRateLimitedValue<TValue, TSelected>;Defined in: packages/ember-pacer/src/rate-limiter/useRateLimitedValue.ts:73
Override this function when writing a class-based helper.
[TValue, (state) => TSelected?]
The positional arguments to the helper
EmberRateLimiterOptions<(value) => void, TSelected>
EmberRateLimitedValue<TValue, TSelected>
compute
1.13.0
Helper.compute