Class: SC.FixturesDataSource


Extends SC.DataSource.

TODO: Describe Class

Defined in: fixtures.js

Since:
SproutCore 1.0

Field Summary

Instance Methods

Field Detail

latency Number

If you set simulateRemoteResponse to YES, then the fixtures source will assume a response latency from your server equal to the msec specified here. You should tune this to simulate latency based on the expected performance of your server network. Here are some good guidelines:

  • 500: Simulates a basic server written in PHP, Ruby, or Python (not twisted) without a CDN in front for caching.
  • 250: (Default) simulates the average latency needed to go back to your origin server from anywhere in the world. assumes your servers itself will respond to requests < 50 msec
  • 100: simulates the latency to a "nearby" server (i.e. same part of the world). Suitable for simulating locally hosted servers or servers with multiple data centers around the world.
  • 50: simulates the latency to an edge cache node when using a CDN. Life is really good if you can afford this kind of setup.
simulateRemoteResponse Boolean

If YES then the data source will asynchronously respond to data requests from the server. If you plan to replace the fixture data source with a data source that talks to a real remote server (using Ajax for example), you should leave this property set to YES so that Fixtures source will more accurately simulate your remote data source.

If you plan to replace this data source with something that works with local storage, for example, then you should set this property to NO to accurately simulate the behavior of your actual data source.

Instance Method Detail

fixtureForStoreKey(store, storeKey)
Based on the storeKey it returns the specified fixtures
Parameters:
store SC.Store
the store
storeKey Number
the storeKey
Returns:
Hash
data hash or null
fixturesFor(recordType)

Get the fixtures for the passed record type and prepare them if needed. Return cached value when complete.

Parameters:
recordType SC.Record
Returns:
Hash
data hashes
fixturesLoadedFor(recordType)
Returns YES if fixtures for a given recordType have already been loaded
Parameters:
recordType SC.Record
Returns:
Boolean
storeKeys
generateIdFor(recordType, dataHash, store, storeKey)

Generates an id for the passed record type. You can override this if needed. The default generates a storekey and formats it as a string.

Parameters:
recordType Class
Subclass of SC.Record
dataHash Hash
the data hash for the record
store SC.Store
the store
storeKey Number
store key for the item
Returns:
String
hasFixturesFor(storeKeys)

Returns YES or SC.MIXED_STATE if one or more of the storeKeys can be handled by the fixture data source.

Parameters:
storeKeys Array
the store keys
Returns:
Boolean
YES if all handled, MIXED_STATE if some handled
loadFixturesFor(store, recordType, ret)

Load fixtures for a given fetchKey into the store and push it to the ret array.

Parameters:
store SC.Store
the store to load into
recordType SC.Record
the record type to load
ret SC.Array
is passed, array to add loaded storeKeys to.
Returns:
SC.FixturesDataSource
receiver
reset()
Resets the fixtures to their original values.
Returns:
SC.FixturesDataSource
receiver
setFixtureForStoreKey(store, storeKey, dataHash)
Update the data hash fixture for the named store key.
Parameters:
store SC.Store
the store
storeKey Number
the storeKey
dataHash Hash
Returns:
SC.FixturesDataSource
receiver
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:20 GMT-0600 (CST)