Skip to content

Repository files navigation

Lifecycle

Lifetime, event, and resource management.

pnpm add @gottheflag/lifecycle

The package provides two primitives:

  • Lifecycle<TEvents> — synchronous cleanup, ownership, child lifecycles, and typed events.
  • AsyncLifecycle<TEvents> — the asynchronous counterpart with awaited teardown.

Requirements

  • Node.js 18.18.0 or newer.
  • TypeScript 5.2 or newer for TypeScript consumers.
  • Runtimes without a native SuppressedError require a polyfill only when both a using block body and its disposal throw.

Documentation

Open docs/index.html directly in a browser for the complete API reference. No documentation server or build step is required.

Development

pnpm check
pnpm playground

Apache-2.0

About

Lifetime, event, and resource management and orchestration.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages