Skip to content

Instantly share code, notes, and snippets.

@alassek
Created September 19, 2011 22:19
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alassek/1227770 to your computer and use it in GitHub Desktop.
Save alassek/1227770 to your computer and use it in GitHub Desktop.
Easy multiple-inheritance in Backbone.js
(function () {
function extendEach () {
var args = Array.prototype.slice.call(arguments),
child = this;
_.each(args, function (proto) {
child = child.extend(proto);
});
return child;
}
Backbone.Model.extendEach =
Backbone.Collection.extendEach =
Backbone.Router.extendEach =
Backbone.View.extendEach = extendEach;
})();
@robinduckett
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment