12.0.0 • Published 4 years ago

@devcorp-libs/streams-killer v12.0.0

Weekly downloads
-
License
-
Repository
-
Last release
4 years ago

NgStreamsKiller

Base class for handling unsubscribe on destroy

Usage

Just extend DclNgStreamsKiller class and use takeUntil(this.killer$) pipe on each observable

Example how to use it

@Component({
  ...
})
export class MyComponent extends DclNgStreamsKiller {

  public readonly sub$: Observable<any>;

  constructor() {
    super();

    this.sub$ = of({}).pipe(
      takeUntil(this.killer$),
    )
  }
}