Class SnapshotRecordArray
publicSnapshotRecordArray is not directly instantiable. Instances are provided to consuming application's adapters for certain requests.
adapterOptions public
Defined in ../store/addon/-private/system/snapshot-record-array.ts:102
A hash of adapter options passed into the store method for this request.
Example
app/adapters/post.js | |
1 2 3 4 5 6 7 8 9 10 |
import MyCustomAdapter from './custom-adapter'; export default class PostAdapter extends MyCustomAdapter { findAll(store, type, sinceToken, snapshotRecordArray) { if (snapshotRecordArray.adapterOptions.subscribe) { // ... } // ... } } |
include public
Defined in ../store/addon/-private/system/snapshot-record-array.ts:126
The relationships to include for this request.
Example
app/adapters/application.js | |
1 2 3 4 5 6 7 8 9 |
import Adapter from ' -data/adapter'; export default class ApplicationAdapter extends Adapter { findAll(store, type, snapshotRecordArray) { let url = `/${type.modelName}?include=${encodeURIComponent(snapshotRecordArray.include)}`; return fetch(url).then((response) => response.json()) } } |
length public
Defined in ../store/addon/-private/system/snapshot-record-array.ts:56
Number of records in the array
Example
app/adapters/post.js | |
1 2 3 4 5 6 7 |
import JSONAPIAdapter from ' -data/adapter/json-api'; export default class PostAdapter extends JSONAPIAdapter { shouldReloadAll(store, snapshotRecordArray) { return !snapshotRecordArray.length; } }); |
meta public
Defined in ../store/addon/-private/system/snapshot-record-array.ts:79
Meta objects for the record array.
Example
app/adapters/post.js | |
1 2 3 4 5 6 7 8 9 |
import JSONAPIAdapter from ' -data/adapter/json-api'; export default class PostAdapter extends JSONAPIAdapter { shouldReloadAll(store, snapshotRecordArray) { let lastRequestTime = snapshotRecordArray.meta.lastRequestTime; let twentyMinutes = 20 * 60 * 1000; return Date.now() > lastRequestTime + twentyMinutes; } }); |
modelName public
Defined in ../store/addon/-private/system/snapshot-record-array.ts:159
The modelName of the underlying records for the snapshots in the array, as a Model
type public
Defined in ../store/addon/-private/system/snapshot-record-array.ts:150
The type of the underlying records for the snapshots in the array, as a Model