Last active
December 10, 2015 14:39
-
-
Save craigmaslowski/4449150 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Backbone.puree = function (config) { | |
if (config.all) { | |
config.view = config.view || []; | |
config.collection = config.collection || []; | |
config.model = config.model || []; | |
config.view = config.view.concat(config.all); | |
config.collection = config.collection.concat(config.all); | |
config.model = config.model.concat(config.all); | |
} | |
_.each(config.view, function (mixin) { | |
Backbone.mixin(Backbone.View, mixin); | |
}); | |
_.each(config.collection, function (mixin) { | |
Backbone.mixin(Backbone.Collection, mixin); | |
}); | |
_.each(config.model, function (mixin) { | |
Backbone.mixin(Backbone.Model, mixin); | |
if (Backbone.DeepModel) { | |
Backbone.mixin(Backbone.DeepModel, mixin); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment