shouldBackgroundReloadRecord (store, snapshot) Boolean
This method is used by the store to determine if the store should reload a record after the store.findRecord method resolves a cached record.
This method is only checked by the store when the store is returning a cached record.
If this method returns true the store will re-fetch a record 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 shouldBackgroundReloadRecord as follows:
shouldBackgroundReloadRecord: function(store, snapshot) {
var connection = window.navigator.connection;
if (connection === 'cellular' || connection === 'none') {
return false;
} else {
return true;
}
}
By default this hook returns true so the data for the record is updated in the background.
Parameters:
-
store
DS.Store -
snapshot
DS.Snapshot
Returns:
-
Boolean
Please login to continue.