Skip to content

Instantly share code, notes, and snippets.

@greatseth
Created August 11, 2014 16:32
Show Gist options
  • Save greatseth/5b66afd03f0b8d5a25b0 to your computer and use it in GitHub Desktop.
Save greatseth/5b66afd03f0b8d5a25b0 to your computer and use it in GitHub Desktop.
Backbone collection subclass attempting to wrap a pattern during initialization. Does not seem to work!
define([
'underscore',
'backbone'
], function (_, Backbone) {
var Collection = Backbone.Collection.extend({
initialize: function(klass, objects) {
Backbone.Collection.prototype.initialize.
apply(this, _.flatten([objects]), { model: klass });
}
});
return Collection;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment