Class DS.SnapshotRecordArray private
Methods
snapshots : Array
Defined in addon/-private/system/snapshot-record-array.js:129
- returns
- Array
Array of snapshots
Get snapshots of the underlying record array
Example
import DS from 'ember-data'
export default DS.JSONAPIAdapter.extend({
shouldReloadAll(store, snapshotArray) {
var snapshots = snapshotArray.snapshots();
return snapshots.any(function(ticketSnapshot) {
var timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt'), 'minutes');
if (timeDiff > 20) {
return true;
} else {
return false;
}
});
}
});
Properties
adapterOptions
Defined in addon/-private/system/snapshot-record-array.js:75
A hash of adapter options passed into the store method for this request.
Example
import MyCustomAdapter from './custom-adapter';
export default MyCustomAdapter.extend({
findAll(store, type, sinceToken, snapshotRecordArray) {
if (snapshotRecordArray.adapterOptions.subscribe) {
// ...
}
// ...
}
});
include
Defined in addon/-private/system/snapshot-record-array.js:98
The relationships to include for this request.
Example
```js {data-filename=app/adapters/application.js} import DS from 'ember-data';
export default DS.Adapter.extend({
findAll(store, type, snapshotRecordArray) {
var url = /${type.modelName}?include=${encodeURIComponent(snapshotRecordArray.include)};
return fetch(url).then((response) => response.json())
} });
length
Defined in addon/-private/system/snapshot-record-array.js:31
Number of records in the array
Example
import DS from 'ember-data'
export default DS.JSONAPIAdapter.extend({
shouldReloadAll(store, snapshotRecordArray) {
return !snapshotRecordArray.length;
},
});
meta
Defined in addon/-private/system/snapshot-record-array.js:53
Meta objects for the record array.
Example
import DS from 'ember-data'
export default DS.JSONAPIAdapter.extend({
shouldReloadAll(store, snapshotRecordArray) {
var lastRequestTime = snapshotRecordArray.meta.lastRequestTime;
var twentyMinutes = 20 * 60 * 1000;
return Date.now() > lastRequestTime + twentyMinutes;
},
});
type
Defined in addon/-private/system/snapshot-record-array.js:120
The type of the underlying records for the snapshots in the array, as a DS.Model