This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

ngx-unsubscriber
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

ngx-unsubscriber

Library to auto unsubscribe observables/subscriptions. Offers class decorators:

  1. NgxUnsubscriber() - Angular

How to use

NgxUnsubscriber()

This decorator is used with Angular components. The decorator forces you to implement the interface IUnsubscribable. This way we make sure to implement ngOnDestory which is needed in case of AOT compilation.

On ngOnDestory the decorator iterates all properties of the component and checks if the current property is subscribable. Subscribable properties are then unsubscribed.

@NgxUnsubscriber()
@Component(...)
export class MyComponent implements IUnsubscribable {

    prop1$: Observable<void>...
    prop2$: Observable<void>...

    ngOnDestory(): void {} // Needed for AOT compilation eventhough it is empty 
}

Dependents (0)

Package Sidebar

Install

npm i ngx-unsubscriber

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

4.96 kB

Total Files

5

Last publish

Collaborators

  • emanuelmistretta