My 5 cents - it seems a bit overkill to use Backbone for flash messages. If the page has only 1 instance of the flash message, you better not use a separate model for it.
Instead, I would use the view for the Flash message and the global dispatcher:
Dispatcher = _.extend({}, Backbone.Events);
Create view:
var FlashMessage = Backbone.View.extend({ initialize: function() { Dispatcher.bind('show_flash_message', this.render); }, render: function(msg) { // do something with the message } });
And from the side of the application where you need to show the flash message, do
Dispatcher.trigger('show_flash_message', 'Some message');
mvbl fst
source share