-
-
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.
Allow the store to pass options to the adapter via a snapshot
Add a SnapshotRecordArray object used for passing snapshots, meta and adapterOptions to the adapter.
- Loading branch information
Showing
7 changed files
with
155 additions
and
43 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,34 @@ | ||
/** | ||
@module ember-data | ||
*/ | ||
|
||
/** | ||
@class SnapshotRecordArray | ||
@namespace DS | ||
@private | ||
@constructor | ||
@param {Array} snapshots An array of snapshots | ||
@param {Object} meta | ||
*/ | ||
function SnapshotRecordArray(snapshots, meta, adapterOptions) { | ||
this.snapshots = snapshots; | ||
this.length = snapshots.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'); | ||
var snapshots = recordArray.invoke('createSnapshot'); | ||
return new SnapshotRecordArray(snapshots, meta, adapterOptions); | ||
}; | ||
|
||
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.