Ember Component life cycle


I have question about memory management during life cycle of Ember Component / View I posted sample code on github. As you can see I’m using observerable and default click event hook. My question is how ember heandle memory management of those things during component’s life cycle. Will be event listeners tear down automaticly when view is destroyed? I know that there are hooks didInsertElement and willDestroyElement which I can use to manage this manualy. Is there any better way to work with observes and events in view/component or is this code fine.

Gist is here: https://gist.github.com/turboMaCk/26a4fd9fb14e0538e698


Ok. Now I found answer in documentation: http://emberjs.com/guides/understanding-ember/managing-asynchrony/#toc_observers

However, when you use the object definition syntax, Ember will automatically tear down the observers when the object is destroyed. For example, if an {{#if}} statement changes from truthy to falsy, Ember destroys all of the views defined inside the block. As part of that process, Ember also disconnects all bindings and inline observers.

From what I saw here, my solution is completely fine and Ember will take care of tearing down everything automatically for me.