1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.2 KiB

/*jslint laxbreak:true */
/*jslint laxcomma:true */
/*jslint loopfunc:true */
/*jslint strict:true */
/*jslint browser:true */
/*jslint devel:true */
define([
"underscore"
, "backbone"
, "models/dmap"
]
, function (_, Backbone, DMAPModel) {
"use strict";
var that
, Collection = Backbone.Collection.extend({
attributes: {}
, model: DMAPModel
, initialize: function (attributes, options) {
that = this
;
if (!_.isObject(options)) {
options = {};
}
if (_.isFunction(options.fetch)) {
that.fetch = options.fetch;
delete options.fetch;
}
if (!_.isUndefined(options.model)) {
that.model = options.model;
delete options.model;
}
Collection.__super__.initialize.call(that, [attributes, options]);
return that;
}
/*
, toJSON: function(options) {
return this.map(function(model){ return model.toJSON(options); });
}
*/
, parse: function () {console.error("PARSE", arguments);}
, fetch: function (options) {
that.trigger("dmap.collection.fetch", this, arguments);
return that;
}
, push: function (attributes, options) {
that.trigger("dmap.collection.push", this, arguments);
return that;
}
});
return Collection;
});