AsyncSignal
July 5, 2026 Β· View on GitHub
Reusable async signals and a data loader .
- π Documentation: https://zhangfisher.github.io/asyncsignal/
- π’ npm: asyncsignal
Overview
AsyncSignal provides two complementary building blocks for asynchronous operations:
asyncSignalβ a reusable async signal. LikePromise.withResolvers(), but resettable, observable, and abort-aware. Suited for event waiting, timeout control, and manual completion.AsyncLoaderβ an async data loader built on top ofasyncSignal. Encapsulates the full loading lifecycle: load + cache + abort + timeout + retry + multiplexing + error fallback + multi-loader.
Features
asyncSignal
- Manual
resolve/reject/resetβ reusable across multiple waits - Static
asyncSignal.resolve()/asyncSignal.reject()for pre-settled signals - Wait timeout,
untilconstraints, and auto-reset - Native
AbortControllerintegration with configurableabortAtbehavior - Status queries (
isPending/isFulfilled/isRejected),result/error/timestamp, and typed metadata
AsyncLoader
- Auto / lazy loading, per-attempt timeout, and automatic retry
- Hash-based caching with pluggable storage
abort()penetrating to the underlying request (fetchsignalready)- Multiplexing (
off/restart/share) to deduplicate concurrent or repeated loads - Error fallback (
defaultValue) - Multi-loader orchestration β
fallbackfailover (switch to backup on failure) andcombinemulti-source merge (concurrent loads aggregated viaonResults)
Installation
# pnpm
pnpm add asyncsignal
# npm
npm install asyncsignal
# yarn
yarn add asyncsignal
# bun
bun add asyncsignal
Package entry points β main entry
asyncsignalships only theasyncSignalsignal part (lighter); the subpathasyncsignal/loaderincludes everything (asyncSignal+AsyncLoader).
Guide
Full guide and API reference at the official site:
π https://zhangfisher.github.io/asyncsignal/
License
MIT