0

I have a memory leak issue in my application somewhere and I have code all over my project that looks like this

this.toastr.success("message sent!", "", {
                    timeOut: 2000
                  });

instead of

 this.timeout = this.toastr.success("message sent!", "", {
                    timeOut: 2000



  ngOnDestroy() {
    clearTimeout(this.timeout);
  }

and I was wondering if not assigning this.timeout to the toast so that I can clear it could be causing the memory leak?

Andy
  • 185
  • 2
  • 6
  • 22
  • I would open an issue at https://github.com/scttcper/ngx-toastr/issues –  Feb 03 '20 at 03:46
  • I'm not saying it's causing a memory leak. I'm not sure if it is. I'm asking if I need to assign this.timeout to it and then ```ngOnDestroy()``` to it as well or will it cause a memory leak? Or is that unneccessary and ```timeOut``` will clear itself from memory? – Andy Feb 03 '20 at 04:04

1 Answers1

1

Timeouts and clearing intervals and timeouts are handled in the toast.component.ts.

So no, the library takes care of that.