I am using a Backbone.js app with a central dispatcher and central view called AppView.
In an initializer, I declare the central dispatcher with:
this.dispatcher = _.extend({}, Backbone.Events);
This dispatcher is passed to every view the app has. Each one can trigger and/or bind to custom events for this dispatcher. In this way, I pretend to allow communication between views without having references to nested views / etc.
My issue is:
If I have several views listening for the same event, when the x event is triggered by someone, all of those views can respond to it. My problem is: Depending of the context (flow) of the application, not all of the listeners should react to that event...
Any workaround? Am I doing something wrong from what a central dispatcher should be?
Thanks!