4 ms·
As someone who's just getting started with Backbone, I'd be very interested to see that talk, and here suggestions for what to do instead of 'this.model.view =
by tialys 15y ago
As someone who's just getting started with Backbone, I'd be very interested to see that talk, and here suggestions for what to do instead of 'this.model.view = this'.
- StavrosK 15y agoIf Spine is anything to go by, you bind events from the view to the model and then trigger them from your code on the model instance.
- jashkenas 15y agoUsually that's the case -- but if you know for certain that there's a one-to-one relationship between a model and it's view, then there's no harm in having a direct reference for convenience. Pragmatism > Purity, where UI code is concerned.
- StavrosK 15y agoI agree with you. I'm concerned about memory leaks from the circular references, though.
- jashkenas 15y agoCircular references are garbage collected -- no need to worry about them. You might be thinking of a terrible old IE bug where circular references between JavaScript objects and DOM nodes were never collected, but that's never been an issue with JavaScript-only references.
- StavrosK 15y agoOh, I didn't know that. That alleviates many of my concerns, then, thank you.
- joubert 15y agoThe Responder pattern used in SproutCore (inspired by Cocoa) is very elegant.