The Mediator pattern enables communication (mediation) between views using a mediator object.In the latest version of Backbone, the Backbone
object itself can be used as a mediator without the need of a seperate helper.
In the following example, triggerSomething
in our ToolbarView
uses the global event-bus on the Backbone
object to broadcast an application wide event somethingHappened
with data.
// First view
var ToolbarView = Backbone.View.extend({
className: ".toolbar",
events: {
"click .button": "triggerSomething"