Reputation: 9712
is there any library that handles this? like the backbone.offline one?, if not, will this be difficult to implement with Ember.js?
UPDATE
this question has two libraries that can help, Breeze.js and Jaydata..
Upvotes: 8
Views: 3919
Reputation: 1709
Looking for a solution also, and came upon the ember-sync project.
This project piggy-backs on Ember-Data, is ember-cli
-ready, and has a queuing feature that smartly handles backend record CRUD. From my brief look into it, I'd say this is the lead project for Ember.js offline-capable apps.
One critique I'd submit on this project is that it ought to also be capable of adapting with epf.io, which itself is a drop-in replacement for Ember-Data and offers transactional CRUD, nested stores -- and even per-model nested store capabilities.
At the time of writing, this project is still in alpha, though it seems to be heading in the right direction.
Upvotes: 1
Reputation: 936
ember-localstorage
adapter can be used.
it can be used like other adapters.
App.store = DS.Store.create({
revision: 11,
adapter: DS.LSAdapter.create()
});
Another good library for ember and rails is ember-data-sync.js
Extend your App.Store from DS.SyncStore. Define the adapter you want to use for client-side storage:
App.Store = DS.SyncStore.extend({
revision: 10,
adapter: DS.IndexedDB.adapter({
mappings: {
person: App.Person,
persons: App.Person,
contact: App.Contact,
contacts: App.Contact
}
})
});
Upvotes: 4
Reputation: 87250
There is no library for this, but you could implement it with a custom adapter. There isn't much documentation for the adapter API and the only ones available in core so far are RESTAdapter
and FixtureAdapter
.
What you basically need to do there is implement couple of hooks and plug that into your application's store.
Upvotes: 3