Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add defaultOptions spec option

  • Loading branch information...
commit 92b7e4d845b9006f3adaef0be291d6fd5181e63c 1 parent 7a1dd6f
Ryan Eastridge authored
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
6 src/collection.js
@@ -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
9 src/data-object.js
@@ -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
6 src/model.js
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.