News for hackers. Stuff that matters.
Re:Step by step from jQuery to Backbone by swah on Tuesday July 24, 2012 @08:54AM (#4285438)
The pub/sub thing is a great pattern and it doesn't make you write more code. In your example, would all the data the modules need to generate their templates be included with the event "loggedin"?
Re:Step by step from jQuery to Backbone by geuis on Tuesday July 24, 2012 @04:16PM (#4287729)
It depends, but generally yes as I do it. I've found that in most cases the size of data associated with an event is quite small and easily passed around as objects, arrays, or whatever is needed. So if a particular module for a sidebar, a headbar, or mainview all need to update based on an event they subscribe to, each module constructs it's own templates based in the data passed with the event.