-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persistence -- Use SproutCore local storage. #6
Comments
SproutCore User Defaults Blog Entry: http://blog.sproutcore.com/scuserdefaults-easy-preferences-using-client-side-storage/ Has link to User Defaults demo, demo code, and SproutCore UserDefaults code. |
UserDefaults is easy, effective, convenient, terribly named, et cetera. For the purposes of this, I don't think we need to showcase fixtures at all, and should have a blank list at launch. Does that mean that this app is going to diverge substantially from the tutorial apps? Is that already the case anyway? |
I agree on removing fixtures. Once the todomvc version is done, we can take from it enhancements to add back to our getting-started Todos app, e.g. item editing. |
Agreed on the backporting – my thought was that fixtures are appropriate to the tutorial but not to this app, making that a permanent delta. |
@dcporter I see from 2010 mailing list posts that you may have implemented data storage with UserDefaults. Do you have an example for making a custom data source that uses local storage? |
No data source, and nothing fancier than what you'd build out of this: anything you set on SC.userDefaults will be gettable next time the user comes back, including serializable data like [arrays] and {POJSOs}. Bearing in mind that the stored versions won't reflect changes to the objects until the next time you SC.userDefaults.set() them, and so on. Mind linking me to my old post? I'm curious. =) |
Ah yes. I never implemented what I was discussing there. userDefaults can't handle SproutCore objects (ergo records), but it can handle arrays and plain objects, so serializing from this app's simple data model into userDefaults shouldn't take a ton of extra work. Per CJ though, that was never formalized into the framework. |
@mauritslamers has provided me with a starter gist for a LocalStorageDataSource, so maybe this will be the way to go. |
If it's public, would you mind linking it here? It's a great feature concept. |
Is it important to showcase SproutCore fixtures, with example todos loaded initially? Or, just remove fixtures altogether and initial app load has no todos?
And how does this fit in with using local storage, if we do use fixtures?
The text was updated successfully, but these errors were encountered: