#

API Docs for: v3.16.0-alpha.2
Show: Inherited Protected Private Deprecated

# SnapshotRecordArray Class

Defined in: `../store/addon/-private/system/snapshot-record-array.js:5`
Module: @ember-data/store

## Constructor

### `SnapshotRecordArray`

(

- `snapshots`
- `meta`

)
private

Defined in `../store/addon/-private/system/snapshot-record-array.js:5`

#### Parameters:

- `snapshots` Array

  An array of snapshots

- `meta` Object

- Index
- Methods
- Properties

## Item Index

### Methods

- snapshots

### Properties

- _recordArray
- _snapshots
- adapterOptions
- include
- length
- meta
- type
- type

## Methods

### `snapshots`

() Array

Defined in `../store/addon/-private/system/snapshot-record-array.js:137`

Get snapshots of the underlying record array

Example

    import JSONAPIAdapter from '@ember-data/adapter/json-api';

    export default 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;
          }
        });
      }
    });

#### Returns:

Array:

Array of snapshots

## Properties

### `_recordArray`

Array private

Defined in `../store/addon/-private/system/snapshot-record-array.js:22`

An array of records

### `_snapshots`

Array private

Defined in `../store/addon/-private/system/snapshot-record-array.js:14`

An array of snapshots

### `adapterOptions`

Object

Defined in `../store/addon/-private/system/snapshot-record-array.js:74`

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`

String | Array

Defined in `../store/addon/-private/system/snapshot-record-array.js:97`

The relationships to include for this request.

Example

    import Adapter from '@ember-data/adapter';

    export default Adapter.extend({
      findAll(store, type, snapshotRecordArray) {
        var url = /${type.modelName}?include=${encodeURIComponent(snapshotRecordArray.include)};

        return fetch(url).then((response) => response.json())
      }
    });

### `length`

Number

Defined in `../store/addon/-private/system/snapshot-record-array.js:30`

Number of records in the array

Example

    import JSONAPIAdapter from '@ember-data/adapter/json-api';

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

### `meta`

Object

Defined in `../store/addon/-private/system/snapshot-record-array.js:52`

Meta objects for the record array.

Example

    import JSONAPIAdapter from '@ember-data/adapter/json-api';

    export default JSONAPIAdapter.extend({
      shouldReloadAll(store, snapshotRecordArray) {
        var lastRequestTime = snapshotRecordArray.meta.lastRequestTime;
        var twentyMinutes = 20 * 60 * 1000;
        return Date.now() > lastRequestTime + twentyMinutes;
      },
    });

### `type`

Model

Defined in `../store/addon/-private/system/snapshot-record-array.js:120`

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

### `type`

Model

Defined in `../store/addon/-private/system/snapshot-record-array.js:128`

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