@altitude/disposables

Manages resources such as RxJS subscriptions and observables, as well as custom disposable resources.

Usage no npm install needed!

<script type="module">
  import altitudeDisposables from 'https://cdn.skypack.dev/@altitude/disposables';
</script>

README

alt-disposables

The Disposables class offers a useful pattern for the consistent contextual management of multiple RxJS observables, subscriptions and custom disposable resources. All managed observables will be automatically cancelled when the dispose method is invoked, all managed subscriptions unsubscribed from, and all custom resources disposed. This not only eliminates potentially difficult to debug memory leaks, but also ensures that no event handlers are invoked when they are no longer in context (for example, their host component is no longer in scope or has reached the end of its lifecycle).