Structuring Your SproutCore Application: Part 2
In Part 1, we started developing a Contact application for managing groups and people. Continuing with Part 2, we’re going to be implementing the application’s functionality in a way that’s going to scale with its complexity.
Loading The Application’s Data
Now that we have the base of our application, we need to start by loading some data into the application. Before we proceed, let’s make sure we’re on the same page. Check out step 4:
git checkout step4 |
We’re going to do this using `SC.FixturesDataSource`
. It allows you to use fixture data local to your application, but also simulates remote responses. That means when you implement a connection to a remote server, your application works as expected. Let’s create the FixturesDataSource in `apps/contact/data_sources/fixtures.js`
:
1 2 3 4 | Contact.FixturesDataSource = SC.FixturesDataSource.extend({ simulateRemoteResponse: YES, latency: 250 }); |
We’ve defined a new FixturesDataSource
class, turned on the simulation of remote responses, and set the latency to 250ms. This is a typical amount of latency between a client and a server but you can tweak this number to suit your needs.
Continue reading