@devcorp-libs/ng-unsubscribe
v1.0.0
Published
Base class for handling unsubscribe on destroy
Downloads
11
Readme
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),
)
}
}