4

I have a component with an @Output variable. This variable must be of type EventEmitter according to the documentation

The EventEmitter looks allot like the Observable class. They share common methods, like subscribe(). One should unsubscribe to Observables after use in order to prevent memory leaks from occuring. Should one do the same with EventEmitter objects? Should i call complete on the object when the component is destroyed?

Maurice
  • 6,698
  • 9
  • 47
  • 104
  • 4
    The question was flagged as opinion-based but, let me say, if this is opinion based then all the programming world is opinion based. By the way, `Output` EventEmitters share the same life cycle of the component. So you shouldn't care about them. You can call `complete` in other EventEmitters if your internal protocol requires it – Christian Vincenzo Traina Sep 22 '20 at 12:50
  • 1
    @CristianTraìna that should be an Answer :) – Dane Brouwer Sep 22 '20 at 12:54

0 Answers0