3 ms·
I also had this exact problem. I posted this question on StackOverflow about it, and the accepted answer led me to the solution I use now, which is identical to
by HerroRygar 15y ago
I also had this exact problem. I posted this question on StackOverflow about it, and the accepted answer led me to the solution I use now, which is identical to the one described in the article:
http://stackoverflow.com/questions/9405148/how-can-i-bubble-up-events-in-a-backbone-view-hierarchy http://stackoverflow.com/questions/9405148/how-can-i-bubble-...
...I always just do something along the lines of window.MyAppNamespace.EventProxy = _.extend({}, Backbone.Events);
The nice thing about this tactic is that it loosely couples interactions between your views. A coworker who also uses Backbone.js prefers passing references between your views to each other. Although this makes the code easier to read in some cases, since it's more obvious what the flow of control is, it tightly couples the components.