unsubscribe-all
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

Unsubscribe All

Angular - Unsubscribe all Subscribed observable on ngDestroy using decorator @UnsubscribeAll()

The subscriber do occupy space in memory and should be released (unsubscribe) of their space once we are done using them. @Unsubscribeall() release all memory once navigate out from the component.

Installation

$ npm install -g unsubscribe-all

Usage

@UnsubscribeAll() // Call on ngDestory unsubscribe all subscribe observable
@Component(){}
export class TestComponent implements OnInit OnDestroy {
 
private subscribe: Subscription;
   constructor(private testService: TestService) { }
 
  ngOnInit() {
    this.subscribe = this.testService.callService().subscribe( res => {
      console.log(res);
    })
  }
 
  ngOnDestory{}
}

Package Sidebar

Install

npm i unsubscribe-all

Weekly Downloads

0

Version

1.4.0

License

ISC

Unpacked Size

5.17 kB

Total Files

10

Last publish

Collaborators

  • shrisowdhaman