@devcorp-libs/ng-unsubscribe
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

NgUnsubscribe

Base class for handling unsubscribe on destroy

Usage

Just extend NgUnsubscribe class and use takeUntil(this.ngUnsubscribe) pipe on each observable

Example how to use it

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

  public readonly sub$: Observable<any>;

  constructor() {
    super();
    
    this.sub$ = of({}).pipe(
      takeUntil(this.ngUnsubscribe),
    )        
  }
}

Readme

Keywords

Package Sidebar

Install

npm i @devcorp-libs/ng-unsubscribe

Weekly Downloads

1

Version

1.0.0

License

none

Unpacked Size

16.5 kB

Total Files

20

Last publish

Collaborators

  • spiotr12