Does addObserver require removeObserver if component destroyed?


I have a use case where I am using addObserver to dynamically add an observer to a component. I’m wondering if I need to pair this with a removeObserver call if:

  1. I only ever add the observer once, and I never try to “change” it or “switch it out”.
  2. I only need it to be ‘removed’ when the component is destroyed.

In short, will Ember effectively ‘remove’ the observer for me when the component is destroyed?

The use case is something like this:

init() {

(Yes, I know I could use in a property instead, but my real use case is more complicated and prevents this.)

Can I simply omit the removeObserver, and ember will effectively take care of this for me when the component is destroyed?

If not (that is, if I DO need to explicitly call removeObserver), what event should I call it on? There is a willDestroyElement event, but is that always equivalent to destroying the component? (That is, is it possible to have the DOM element destroyed, but not the component? For example, if the component is inside an {{if}} in an HBS file?)

Thanks in advance!

Ember.computed task.isRunning == "You modified isRunning twice in a single render" [SOLVED]