Sync localstorage with server strategy #21

raDiesle opened this Issue Feb 8, 2012 · 6 comments


None yet
5 participants

raDiesle commented Feb 8, 2012

How about a way to dynamically change the sync-strategy during runtime with an example?

I am also interested in this.



jeromegn commented Jan 14, 2013

How would this work? I'm interested too.

Basically on the first fetch, use localSync and then lookup updates on the server? What would the API look like?

Maybe it would help if I post my use case for this. I want to let both unregistered and registered users use my app. If the user is registered/logged-in, then use server sync. Otherwise, sync to local storage.


jeromegn commented Jan 14, 2013

Well, that's easy. When the user is not registered, just set the localStorage property in your collection or model, as written in the README.

For that class, it'll use the localStorage adapter, but if it's not present then it'll use the normal Backbone.sync method.

jeromegn closed this May 12, 2013

I am interested in this question too. You say "Well, that's easy", but you're not answering the question directly.

In our project, we need to create server bound collections, but a way to make it local temporarily, then make change it to a remote collection. The expected behaviour is that that local collection would sync itself with the server. See it like a local transaction, that is committed to the server.

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