Skip to content

Latest commit

 

History

History
137 lines (88 loc) · 3.12 KB

File metadata and controls

137 lines (88 loc) · 3.12 KB
id injectQueuedValue
title injectQueuedValue

Function: injectQueuedValue()

Call Signature

function injectQueuedValue<TValue, TSelected>(
   value, 
   options?, 
selector?): QueuedSignal<TValue, TSelected>;

Defined in: angular-pacer/src/queuer/injectQueuedValue.ts:31

An Angular function that creates a queued value that processes state changes in order with an optional delay. This function uses injectQueuedSignal internally to manage a queue of state changes and apply them sequentially.

The queued value will process changes in the order they are received, with optional delays between processing each change. This is useful for handling state updates that need to be processed in a specific order, like animations or sequential UI updates.

The function returns a tuple containing:

  • A Signal that provides the current queued value
  • The queuer instance with control methods

Type Parameters

TValue

TValue

TSelected

TSelected extends Pick<QueuerState<TValue>, "items"> = Pick<QueuerState<TValue>, "items">

Parameters

value

Signal<TValue>

options?

QueuerOptions<TValue>

selector?

(state) => TSelected

Returns

QueuedSignal<TValue, TSelected>

Example

const initialValue = signal('initial')
const queued = injectQueuedValue(initialValue, {
  wait: 500,
  started: true,
})

// Add changes to the queue
queued.addItem('new value')

Call Signature

function injectQueuedValue<TValue, TSelected>(
   value, 
   initialValue, 
   options?, 
selector?): QueuedSignal<TValue, TSelected>;

Defined in: angular-pacer/src/queuer/injectQueuedValue.ts:42

An Angular function that creates a queued value that processes state changes in order with an optional delay. This function uses injectQueuedSignal internally to manage a queue of state changes and apply them sequentially.

The queued value will process changes in the order they are received, with optional delays between processing each change. This is useful for handling state updates that need to be processed in a specific order, like animations or sequential UI updates.

The function returns a tuple containing:

  • A Signal that provides the current queued value
  • The queuer instance with control methods

Type Parameters

TValue

TValue

TSelected

TSelected extends Pick<QueuerState<TValue>, "items"> = Pick<QueuerState<TValue>, "items">

Parameters

value

Signal<TValue>

initialValue

TValue

options?

QueuerOptions<TValue>

selector?

(state) => TSelected

Returns

QueuedSignal<TValue, TSelected>

Example

const initialValue = signal('initial')
const queued = injectQueuedValue(initialValue, {
  wait: 500,
  started: true,
})

// Add changes to the queue
queued.addItem('new value')