/unsubscriber

Easy to use service to unsubscribe from RxJs observable

Primary LanguageTypeScriptMIT LicenseMIT

Unsubscriber

Easy to use service to unsubscribe from RxJs observables.

Instalation

npm i @cdgstudio/unsubscriber

Example of use

@Component({
  providers: [Unsubscriber],
})
export class MyComponent implements OnInit {
  constructor(private unsubscriber: Unsubscriber) {}

  ngOnInit(): void {
    // with takeUntil pattern
    interval(1000).pipe(takeUntil(this.unsubscriber)).subscribe();

    // with unsubscribe pattern
    this.unsubscriber.add = interval(1000).subscribe();
  }
}

Angular version support

Angular version Support
>=12 Yes
<12 No