Heydon / niace-stories-app

The alpha application for NIACE.
1 stars 1 forks source link

Sprint 2 - Offline data #45

Closed Heydon closed 9 years ago

Heydon commented 9 years ago

Here's what we need to do. Comments welcome, Rob.

  1. Replace our data strategy with a GroundDB one. Don't worry, it's more or less a like-for-like change except GroundDB caches data and methods in minified localstorage data. This is the extension: https://github.com/GroundMeteor/db
  2. On first run, we will need to provide a prepopulated warm cache. This will probably require us to load from json files if the cache returns false on a test in Meteor.startup()
  3. For each successive use, the test for an empty cache will return false and we can just use the grounded strategy (which will sync with the cloud data automatically if it's connected)

    Notes

    • According to their docs we can "ground" our existing collections, so hopefully we can sit this support on top of existing functionality (bearing in mind the startup build noted above)
  // Ground an existing Meteor.Collection  
  var list = new Meteor.Collection(null);
  // just ground the database and map on suffix `list`
  GroundDB(list, 'list');
Heydon commented 9 years ago

This post describes a completely offline strategy using appcache as well: http://blog.groupbuddies.com/posts/45-offline-web-apps-with-meteor

Heydon commented 9 years ago

Done and tested in Cordova app.