Skip to content
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

Open
geojeff opened this issue Jun 19, 2013 · 11 comments
Open

Persistence -- Use SproutCore local storage. #6

geojeff opened this issue Jun 19, 2013 · 11 comments

Comments

@geojeff
Copy link
Member

geojeff commented Jun 19, 2013

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?

@geojeff
Copy link
Member Author

geojeff commented Jun 19, 2013

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.

@dcporter
Copy link
Member

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?

@geojeff
Copy link
Member Author

geojeff commented Jun 20, 2013

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.

@dcporter
Copy link
Member

Agreed on the backporting – my thought was that fixtures are appropriate to the tutorial but not to this app, making that a permanent delta.

@geojeff
Copy link
Member Author

geojeff commented Jun 20, 2013

@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?

@dcporter
Copy link
Member

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. =)

@geojeff
Copy link
Member Author

geojeff commented Jun 20, 2013

@dcporter
Copy link
Member

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.

@geojeff
Copy link
Member Author

geojeff commented Jun 20, 2013

@mauritslamers has provided me with a starter gist for a LocalStorageDataSource, so maybe this will be the way to go.

@dcporter
Copy link
Member

If it's public, would you mind linking it here? It's a great feature concept.

@geojeff
Copy link
Member Author

geojeff commented Jun 20, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants