I would like to take advantage of both the Ember Local Storage Adapter (LSAdapter) and the Ember REST Adapter (RESTAdapter), so that there is a centralized database for all users, avoiding sending an Ajax request for each user action.
In particular, I would like to:
- Fill the LSAdapter with data from the server.
- All changes made by users are updated in the LSAdapter. (I know how to take this step)
(In preparation for # 3, I may have a model that saves the log in the LSAdapter of all updates). - After n minutes, the LSAdapter update data is sent back to the server.
My server server is NOT Rails, so please generalize the answers.
Can I use the BOTH LSAdapter and RESTAdapter in an Ember app? If yes, provide an example code on how to configure it.
I would also appreciate if you would provide a sample code for steps 1 and 3, mainly how the database can talk to local storage and vice versa.
If it is not possible to have both an LSADapter and a RESTAdapter, what can I do to complete steps 1 and 3?
The only thing I can think of is setting up the Ember application store as a RESTAdapter, and then calling Web Storage localstorage directly into my application, without calling it at all from LSAdapter. Let me know if there is a simpler or inline way.
Haoqi li
source share