Skip to content

Instantly share code, notes, and snippets.

@zackham
Created November 9, 2011 15:39
Show Gist options
  • Save zackham/1351818 to your computer and use it in GitHub Desktop.
Save zackham/1351818 to your computer and use it in GitHub Desktop.
// allow setting / triggering of events for all instances
_.extend(SG, Backbone.Events);
_.extend(SG.prototype, Backbone.Events, {
// allow binding to events triggered from any instance
// used for hooking into initialize:after by plugins
setupGlobalEvents: function() {
this.bind('all', function() {
var argsWithoutEv = Array.prototype.slice.call(arguments, 1);
SG.trigger.apply(SG, [arguments[0], this].concat(argsWithoutEv));
}, this);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment