Skip to content

Loading Status

isPending() / isFulfilled() / isRejected() reflect the execution status of the loading task (interface aligned with the asyncSignal methods of the same name).

typescript
const loader = new AsyncLoader(fn, { autostart: false });

loader.isPending(); // whether loading is in progress (including retries)
loader.isFulfilled(); // whether the load succeeded
loader.isRejected(); // whether the load failed (business error / timeout / abort)

await loader.get();
loader.isFulfilled(); // true

Status semantics

MethodCondition for true
isPending()Actually loading (including retries), based on loading
isFulfilled()The load succeeded (including defaultValue fallback)
isRejected()The load failed (business error / timeout / abort)

isPending detail

isPending() is based on loading: it is only true while actually loading. When "never loaded" or after invalidate(), the signal is still pending but no load is in progress, so this returns false.

The loading property is also directly accessible, with the same semantics as isPending().

Released under the MIT License.