/rxjs-complete-when

An RxJS operator that causes an observable to complete early if/when another controlling observable completes.

Primary LanguageTypeScriptMIT LicenseMIT

RxJS completeWhen Operator

by David Björkevik

An RxJS operator that causes an observable to complete early if/when another controlling observable completes.

This is very useful to easliy limit the lifetime of a pipe, for instance when writing user interface modules: Set up a simple Subject called "destroyed" for your UI component and call its .complete()-method upon component destruction. Now you may use .pipe(completeWhen(destroyed)) to make sure your subscriptions are cancelled when your component is destroyed.

Installation

npm install rxjs-complete-when