Permalink
Browse files

Add defaultOptions spec option

  • Loading branch information...
1 parent 7a1dd6f commit 92b7e4d845b9006f3adaef0be291d6fd5181e63c Ryan Eastridge committed Dec 26, 2012
Showing with 14 additions and 7 deletions.
  1. +6 −0 src/collection.js
  2. +2 −7 src/data-object.js
  3. +6 −0 src/model.js
View
@@ -45,6 +45,12 @@ dataObject('collection', {
bind: 'bindCollection',
unbind: 'unbindCollection',
options: '_setCollectionOptions',
+ defaultOptions: {
+ render: true,
+ fetch: true,
+ success: false,
+ errors: true
+ },
change: '_onCollectionReset',
$el: 'getCollectionElement',
cidAttrName: collectionCidAttributeName
View
@@ -67,14 +67,9 @@ function dataObject(type, spec) {
function objectOptions(dataObject, options) {
if (!this._objectOptionsByCid[dataObject.cid]) {
- this._objectOptionsByCid[dataObject.cid] = {
- render: true,
- fetch: true,
- success: false,
- errors: true
- };
+ this._objectOptionsByCid[dataObject.cid] = {};
}
- _.extend(this._objectOptionsByCid[dataObject.cid], options || {});
+ _.extend(this._objectOptionsByCid[dataObject.cid], spec.defaultOptions, options);
return this._objectOptionsByCid[dataObject.cid];
}
View
@@ -30,6 +30,12 @@ dataObject('model', {
bind: 'bindModel',
unbind: 'unbindModel',
options: '_setModelOptions',
+ defaultOptions: {
+ render: true,
+ fetch: true,
+ success: false,
+ errors: true
+ },
change: '_onModelChange',
$el: '$el',
cidAttrName: modelCidAttributeName

0 comments on commit 92b7e4d

Please sign in to comment.