DS.Adapter#shouldBackgroundReloadAll()

shouldBackgroundReloadAll (store, snapshotRecordArray) Boolean

Defined in addon/adapter.js:619
Available since 1.13.0

This method is used by the store to determine if the store should reload a record array after the store.findAll method resolves with a cached record array.

This method is only checked by the store when the store is returning a cached record array.

If this method returns true the store will re-fetch all records from the adapter.

For example, if you do not want to fetch complex data over a mobile connection, or if the network is down, you can implement shouldBackgroundReloadAll as follows:

shouldBackgroundReloadAll: function(store, snapshotArray) {
  var connection = window.navigator.connection;
  if (connection === 'cellular' || connection === 'none') {
    return false;
  } else {
    return true;
  }
}

By default this method returns true, indicating that a background reload should always be triggered.

Parameters:

store DS.Store
snapshotRecordArray DS.SnapshotRecordArray

Returns:

Boolean
doc_EmberJs
2016-11-30 16:49:25
Comments
Leave a Comment

Please login to continue.