Skip to content

Instantly share code, notes, and snippets.

@thegrubbsian
Created July 30, 2011 15:56
Show Gist options
  • Save thegrubbsian/1115668 to your computer and use it in GitHub Desktop.
Save thegrubbsian/1115668 to your computer and use it in GitHub Desktop.
Backbone.js Proxy Event Method
Backbone.View.prototype.proxy = function(source, eventName, options) {
if (!options) { options = {}; }
var self = this;
source.bind(eventName, function(args) {
var name = options["proxyName"] || eventName;
var newArgs = options["proxyArgs"] ? _.combine(args, options["proxyArgs"]) : args;
self.trigger(name, newArgs);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment