I'm working on an app where I'd like to use an "offline first" approach; to that end, I'm trying to integrate PouchDB
for handling the local data, with an eventual CouchDB backend. I have been going through the Model/Collection/Source/Store docs and API info, but I am still not sure how best to design and implement a solution for this.
As I understand it: enyo.Store keeps local copies of all enyo.Model and enyo.Collection objects, and uses enyo.Source (if necessary) to fetch objects from a remote server. However, I am not sure how to leverage these objects (or subkinds of these objects) to instead use PouchDB as the canonical data source.
Originally I was thinking that I would just write a new Source for fetching objects from PouchDB, but then once PouchDB is synching with a server I'm not sure if I'd run into problems with keeping the Store up to date (since PouchDB just syncs data on its own schedule). Creating a sub-kind of enyo.Store and rewiring it to use PouchDB for its local data seems like a lot of extraneous effort, and likely to be difficult to maintain.
Any ideas/advice? This is probably a really obvious problem for people who have a more in-depth understanding of the system, but it's the first time I've taken a look at the model stuff in Enyo 2.3/2.4.