W3cubDocs

/Ember.js 4

Class SnapshotRecordArray

public
Defined in: ../packages/store/addon/-private/network/snapshot-record-array.ts:17
Module: @ember-data/store

adapterOptions public

Module: @ember-data/store

A hash of adapter options passed into the store method for this request.

Example

app/adapters/post.js
import MyCustomAdapter from './custom-adapter';

export default class PostAdapter extends MyCustomAdapter {
  findAll(store, type, sinceToken, snapshotRecordArray) {
    if (snapshotRecordArray.adapterOptions.subscribe) {
      // ...
    }
    // ...
  }
}

include public

Module: @ember-data/store

The relationships to include for this request.

Example

app/adapters/application.js
import Adapter from '@ember-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

Module: @ember-data/store

Number of records in the array

Example

app/adapters/post.js
import JSONAPIAdapter from '@ember-data/adapter/json-api';

export default class PostAdapter extends JSONAPIAdapter {
  shouldReloadAll(store, snapshotRecordArray) {
    return !snapshotRecordArray.length;
  }
});

modelName public

Module: @ember-data/store

The modelName of the underlying records for the snapshots in the array, as a Model

© 2022 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember-data/4.9/classes/SnapshotRecordArray/properties