Skip to content

Instantly share code, notes, and snippets.

@berzniz
Created March 12, 2012 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save berzniz/2025061 to your computer and use it in GitHub Desktop.
Save berzniz/2025061 to your computer and use it in GitHub Desktop.
Backbone.js global notifications made easy
var FirstView = Backbone.View.extend({
initialize: function() {
Backbone.Notifications.on('SomeViewRendered', function (msg) {
alert(msg);
}, this);
}
});
var SecondView = Backbone.View.extend({
render: function() {
Backbone.Notifications.trigger('SomeViewRendered', 'nice message for anyone to read');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment