PromiseLogic.allSettled()

Core Logic GateWaits for all Promises to complete (regardless of success or failure)

The PromiseLogic.allSettled() method implements ALLSETTLED (all completed) logic gate semantics, waiting for all Promises to complete (regardless of success or failure), returning an array containing the status of each Promise. It returns a PromiseWithTimer instance which wraps native Promise and provides additional functionality.

Syntax

javascript
 PromiseLogic.allSettled(iterable)

Parameters

ParameterTypeDescription
iterableIterable<T | PromiseLike<T>>An iterable collection of Promise objects

Return Value

Returns a PromiseWithTimer that resolves to an array of completion status of all Promises, containing success or failure information for each Promise.

PromiseWithTimer<PromiseSettledResult<T>[]>

Behavior

Completion Condition

Waits for all Promises to complete (regardless of success or failure), returns a PromiseWithTimer that resolves to an array containing the status of each Promise.

Special Case

The allSettled method never fails, always returns a successful result array.

Examples

Basic Usage

ALLSETTLED Logic Example - Waits for all Promises to complete

JAVASCRIPT
Loading...

Timeout Control

Add timeout control with maxTimer method

JAVASCRIPT
Loading...

Result Processing

ALLSETTLED Logic Example - Process completion results

JAVASCRIPT
Loading...

Real Application

Batch operation result analysis with timeout

JAVASCRIPT
Loading...

Important Notes

  • ALLSETTLED logic behaves exactly like standard Promise.allSettled()
  • Returns PromiseWithTimer which supports maxTimer() for timeout control
  • maxTimer can only detect timeout, cannot cancel Promise operation itself
  • Always returns successful results, containing completion status of all Promises
  • Suitable for scenarios requiring knowledge of all operation results, such as batch operations, result analysis
  • Returned array contains status (fulfilled or rejected) and corresponding value or reason for each Promise