Defined in: packages/ember-pacer/src/async-queuer/useAsyncQueuedState.ts:52
Exposes pending queue items together with the queue that processes them.
Retains accepted items until processing. Ordering, capacity, wait, and started options follow the underlying queue.
Yields the queue instance. Read pending items from queue.state.items and enqueue with queue.addItem().
Items are selected by default. A custom selector must retain items and may add other state fields. The returned collection contains pending items; async active items are separate.
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 { on } from '@ember/modifier'
import { fn } from '@ember/helper'
import { useAsyncQueuedState } from '@tanstack/ember-pacer'
// Inside a component template:
<template>
{{#let (useAsyncQueuedState @process wait=500) as |queue|}}
<button {{on "click" (fn queue.addItem 1)}}>Add</button>
<output>{{queue.state.items.length}}</output>
{{/let}}
</template>useAsyncQueuer
TValue
TSelected extends Pick<AsyncQueuerState<TValue>, "items"> = Pick<AsyncQueuerState<TValue>, "items">
new UseAsyncQueuedState<TValue, TSelected>(owner?): UseAsyncQueuedState;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
UseAsyncQueuedState
Helper<{
Args: {
Positional:
| [fn: (item: TValue) => Promise<any>]
| [
fn: (item: TValue) => Promise<any>,
selector: (state: AsyncQueuerState<TValue>) => TSelected,
]
Named: EmberAsyncQueuerOptions<TValue, TSelected>
}
Return: EmberAsyncQueuer<TValue, TSelected>
}>.constructorcompute(positional, options): EmberAsyncQueuer<TValue, TSelected>;Defined in: packages/ember-pacer/src/async-queuer/useAsyncQueuedState.ts:78
Override this function when writing a class-based helper.
[(item) => Promise<any>, (state) => TSelected]
The positional arguments to the helper
EmberAsyncQueuerOptions<TValue, TSelected>
EmberAsyncQueuer<TValue, TSelected>
compute
1.13.0
Helper.compute