serializeQueueNext
serializeQueueNext<
T>(func):AsyncCallable<[AbortSignal|null],T>
Defined in: packages/core/src/function/serialize-queue-next.ts:24
Wraps an asynchronous function to ensure that only one instance runs at a time, and if called again while running, only one additional call is queued to run immediately after the current one completes.
This pattern serializes async operations and queues at most one next call. If multiple calls are made while an operation is in progress, they all share the same promise for the next execution.
Useful for preventing overlapping async operations (such as network or file requests) while ensuring that the latest requested operation is not lost.
This is a specialized form of serialization with a single-call queue, zero wait time, and no arguments.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”The asynchronous function to wrap.
Returns
Section titled “Returns”AsyncCallable<[AbortSignal | null], T>
The wrapped function.