Skip to content

Instantly share code, notes, and snippets.

Backbone.mixin = function (obj, mixin) {
var source = obj.prototype || obj;
if (!mixin)
throw new Error('Backbone.mixin: The mixin specified is undefined.');
// merge all properties in the mixin into the view's prototype
_.defaults(source, mixin);
// merge object literal properties (ensure's events, bindings, and channels)