PromiseLogic.nor()

Composite Logic GateNOR Logic - Succeeds when all Promises fail

The PromiseLogic.nor() method implements NOR (NOT OR) logic gate semantics, succeeding when all Promises fail. It returns a PromiseWithTimer instance which wraps native Promise and provides additional functionality.

Syntax

javascript
 PromiseLogic.nor(iterable)

Parameters

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

Return Value

Returns a PromiseWithTimer that resolves to empty array when all Promises fail.

PromiseWithTimer<T[]>

Behavior

Success Condition

When all Promises fail, PromiseWithTimer resolves to empty array.

Failure Condition

When at least one Promise succeeds, PromiseWithTimer is rejected.

Error Types

NOR_ERRORThrown when at least one Promise succeeds

Examples

Basic Usage

NOR Logic Example - Succeeds when all Promises fail

JAVASCRIPT
Loading...

Error Handling

NOR Logic Failure Example - At least one succeeds

JAVASCRIPT
Loading...

Timeout Control

Add timeout control with maxTimer method

JAVASCRIPT
Loading...

Real Application

Complete system failure detection with timeout

JAVASCRIPT
Loading...

Important Notes

  • NOR logic is negation of OR logic, succeeds when all Promises fail
  • Returns PromiseWithTimer which supports maxTimer() for timeout control
  • maxTimer can only detect timeout, cannot cancel Promise operation itself
  • Suitable for scenarios detecting complete system failure
  • Returns empty array when all Promises fail
  • When at least one Promise succeeds, throws NOR_ERROR