Search code examples
jsonhtml5-appcachelawnchairlocalforage

Should i use Lawnchair or localForage to maintain data offline


I'm writing an app using Ionic framework. I use mongodb as a datastore in the cloud but the lists are too comprehensive and is slowing the app down. After consuming millions of hours reading about client side storage I still dont have a clear answer.

I hoped it would be possible to serve these comprehensive json files native from the client, which is ios + android + windows phone but having not "server" to serve it that idea seemed to be a dud. Dont know if my limited understanding of the rest API in angular is at fault but logically that idea doesn't make sense.

Looking at on native sql clietn I investigated sqlite. Since sqlite implementation on these different platforms(ios + android + windows phone) will be a pain i looked at the different types of browser caching.

I dont want to go into to much detail but localstorage is to simple for my structures, and the other options are not being supported or deprecated. Its a mess. However, the two options regarding offline data solution i have found is Lawnchair and localForage.

What is the differences between these two as they provide the most comprehensive solution based on the client. Any one willing to suggest a beter / worse option.

Then there is the site files which i also want to cache using app cache but I'm not sure how to since I'm using https://www.npmjs.org/package/generator-ionic which is kick-ass by the way.


Solution

  • Lawnchair syntax is a bit more complicated than localForage and the project is no longer updated whereas localForage is (and it's developped by mozilla).

    If you are using angular, then go with https://github.com/ocombe/angular-localForage which is my implementation of localForage for Angular, it will be really easy and you can force the driver you want to use if necessary (but on mobile local storage will never be choosen since all mobile smartphones support either websql or indexeddb).