-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3310 from bmac/snapshot-array
Allow the store to pass adapter options to the adapter
- Loading branch information
Showing
7 changed files
with
172 additions
and
40 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
@module ember-data | ||
*/ | ||
|
||
/** | ||
@class SnapshotRecordArray | ||
@namespace DS | ||
@private | ||
@constructor | ||
@param {Array} snapshots An array of snapshots | ||
@param {Object} meta | ||
*/ | ||
function SnapshotRecordArray(recordArray, meta, adapterOptions) { | ||
this._snapshots = null; | ||
this._recordArray = recordArray; | ||
this.length = recordArray.get('length'); | ||
this.meta = meta; | ||
this.adapterOptions = adapterOptions; | ||
} | ||
|
||
/** | ||
@method fromRecordArray | ||
@private | ||
@static | ||
@param {DS.RecordArray} recordArray | ||
@param {Object} adapterOptions | ||
@return SnapshotRecordArray | ||
*/ | ||
SnapshotRecordArray.fromRecordArray = function(recordArray, adapterOptions) { | ||
var meta = recordArray.get('meta'); | ||
return new SnapshotRecordArray(recordArray, meta, adapterOptions); | ||
}; | ||
|
||
SnapshotRecordArray.prototype.snapshots = function() { | ||
if (this._snapshots) { | ||
return this._snapshots; | ||
} | ||
var recordArray = this._recordArray; | ||
this._snapshots = recordArray.invoke('createSnapshot'); | ||
|
||
return this._snapshots; | ||
}; | ||
|
||
export default SnapshotRecordArray; |
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
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
Oops, something went wrong.