Gist 5246946
✓ Published0🌍 Public
MModuloM
Last edited Mar 18, 2013
Created on Mar 26, 2013
This example demonstrates how the Mediator pattern enables communication between Backbone views without direct coupling. A ToolbarView triggers a global event named `somethingHappened` with a data object via `Backbone.trigger()`, while a TableView subscribes to that event using `Backbone.on()` in its `initialize` method and unsubscribes with `Backbone.off()` in its `destroy` method. The code uses the Backbone event bus as a mediator, showing both the classic `on`/`off` API and mentions the newer `listenTo` alternative.
AI-generated description