Skip to content

Memory Management

Store unsubscribe handles and call them during cleanup:

ts
const stops = [lifecycle.on("page:visible", onVisible), lifecycle.on("page:hidden", onHidden)];

function cleanup() {
  for (const stop of stops) stop();
  void lifecycle.dispose();
}

Registering anonymous listeners without a matching unsubscribe path.

Production recommendation

Wire cleanup into framework teardown (useEffect return, onUnmounted, ngOnDestroy).

An ecosystem of independent, headless TypeScript libraries engineered for modern web development. Every package includes interactive playgrounds and documentation that evolves alongside the code.