Overview
ZeroPromise<T> is a Promise-compatible wrapper with explicit lifecycle: active → resolved | rejected | cancelled. It exposes .signal (AbortSignal) and .cancel() so fetchers and UI can abort in-flight work.
Mates HTTP helpers return ZeroPromise. asyncAtom / asyncAction inject the current run as { zero } so you can pass zero.signal into fetch or call zero.cancel().
ZeroPromise vs Promise
|
API
|
Cancel
|
State
|
|---|---|---|
Promise
| No built-in cancel | Settles once; no AbortSignal. |
ZeroPromise
|
.cancel() + .signal
|
isActive / isResolved / isRejected / isCancelled.
|
Resolve vs cancel
Start a 2s ZeroPromise, then cancel before it resolves. Status tracks active / resolved / cancelled.
AbortSignal + fetch
Pass zero.signal into fetch. Cancel aborts the network request.