0
votes

From what I have read http://lostechies.com/derickbailey/2011/09/15/zombies-run-managing-page-transitions-in-backbone-apps/ and Backbone.js : repopulate or recreate the view? I learned that hidden view should be unbind'ed from events.

How about removing a model? After calling

  • remove() on Collection
  • destroy() on the Model
  • remove() on View

Shall I call off() on Model as the last step?

Assuming no one else hold a reference to the instance of the model, is that the end of zombie killing? The view might still have a reference to the model, should the view's this.model set to null?

Anymore memory leak?

Thank you

1

1 Answers

4
votes

Read the annoted source , it's pretty clear what model.destroy() does , it doesnt delete the model , just request the server to delete a REST resource. if you want to get rid of the model in your script you can create a destroy function to your view that will erase any objects you want to get rid of.

http://documentcloud.github.com/backbone/docs/backbone.html

regarding events , i'm not sure , but yeah you could call off , you could also spy the internal event object of the model in your browser dev tools to see if it still exists after you delete the model.