Re:Hello Backbone.js - A step-by-step tutorial
by StavrosK on Tuesday June 07, 2011 @10:27AM
(#2629228)
If 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.
[ Parent
| on HN ]
Re:Hello Backbone.js - A step-by-step tutorial
by jashkenas on Tuesday June 07, 2011 @10:47AM
(#2629314)
Usually 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.
Re:Hello Backbone.js - A step-by-step tutorial
by StavrosK on Tuesday June 07, 2011 @10:50AM
(#2629329)
I agree with you. I'm concerned about memory leaks from the circular references, though.
Re:Hello Backbone.js - A step-by-step tutorial
by jashkenas on Tuesday June 07, 2011 @11:02AM
(#2629379)
Circular 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.