1

I wanted to know if I am doing things in a correct way in order to avoid memory leaks.

So, I have an iFrame inside a Backbone view. On click of some elements inside of that iframe I want to execute some functions inside the view.

For example

Let's say that, there is a div element inside that iFrame and want to change color of that div on click of that div.

So inside afterRender() hook I've added event binding like below:

this.$('#myframe').contents().find('body')
  .on('click', '#divSample', 
    $.proxy(function(evt){
            //change color
            this.showSettingsPopup();
  }, this)
);

So how should I go about unbinding events or what other things should be done in order to avoid memory leaks.

Currently in dispose method I'm detaching events.

Bharat Patil
  • 1,398
  • 1
  • 11
  • 28

0 Answers0