Lifetime, event, and resource management.
pnpm add @gottheflag/lifecycleThe package provides two primitives:
Lifecycle<TEvents>— synchronous cleanup, ownership, child lifecycles, and typed events.AsyncLifecycle<TEvents>— the asynchronous counterpart with awaited teardown.
- Node.js 18.18.0 or newer.
- TypeScript 5.2 or newer for TypeScript consumers.
- Runtimes without a native
SuppressedErrorrequire a polyfill only when both ausingblock body and its disposal throw.
Open docs/index.html directly in a browser for the complete API reference. No documentation server or build step is required.
pnpm check
pnpm playground