-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Do not override Backbone.sync #75
Comments
If it’s that simple that works for me. I don’t like the override we do but I haven’t ever built a big Backbone app with multiple sync adapters, so I’m a bit out of my depth on what the best practice is. |
I'm sure the current implementation works for most users, but with a little change it can work for everyone. It just occurred to me a simpler usage: var LocalModel = Backbone.Model.extend({
sync: Backbone.localforage.sync('storename') // Use a store for the model
});
var OtherLocalModel = Backbone.Model.extend({
sync: Backbone.localforage.sync() // Use the model's collection store
}); I can send a pull request if there's consensus about this. |
Oh wow, I really like that. That would be amazing 👍 |
I like that as well. |
Fixed in ff38f31 |
I'll fix the Backbone example according to this changes. |
I already did, no worries :-) Matthew Riley MacPherson (Sent from mobile)
|
I think Backbone adapters shouldn't modify the original sync function since it can be a important source of incompatibilities with other libs. It could just provide the sync function to be used on the selected models and collections (or manually overriding the default function if we want to).
Here's an example of a better approach IMO:
Any ideas?
The text was updated successfully, but these errors were encountered: