0

Is this normal in Backbone that after a .remove() on a view I'm still able to access the events object via console.log ?

var View = Backbone.View.extend({

    initialize : function () {
        console.log("hey");
    },

    events: {
        "click ul#products li a": "item"
    }           

});

var vi = new View;
vi.off();
vi.remove();
vi.undelegateEvents();

console.log(vi);
bdo334
  • 380
  • 2
  • 9
  • 20
  • possible duplicate of [Destroy or remove a view in Backbone.js](http://stackoverflow.com/questions/6569704/destroy-or-remove-a-view-in-backbone-js) – gherkins Oct 08 '13 at 08:03
  • Your `vi` is not an event object but view object so as long as that variable still in scope your view won't get garbage collected. – j03w Oct 08 '13 at 08:25
  • May I ask you a exemple j03w ? http://jsfiddle.net/RDch8/200/ – bdo334 Oct 08 '13 at 08:53
  • You can set your object to undefined `vi = undefined` after destroying the view. – Puigcerber Oct 08 '13 at 11:26

0 Answers0