Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quasar Framework - What is the safest way to store local persistent data (for Web, Cordova & Electron platforms)?

What is the safest way to store data offline, assuming that I want to cover all platforms (Web, Electron & Cordova).

The reason I ask is, my app Fudget (which is a Cordova / Electron - but not Quasar) uses WebSQL to store the user's app data locally. This has worked ok for years (I occasionally had an Android user whose data would be wiped by the Android OS - but not often).

But in the last couple of days, 100's of Android users are having their WebSQL (and local storage) removed (does anybody know why?), so I'm getting a lot of angry emails from people who've lost all their data and settings.

I'm currently working on Fudget 2 (using Quasar) and want to make sure this doesn't happen again. I want to cover all the platforms (Web, Mac, Windows, iOS, Android) and want to store the data in JavaScript objects locally, so what is the safest way to store this data locally for all of these platforms?

Obviously it seems that Local Storage and WebSQL (which is now deprecated anyway) are not safe. But can I used IndexedDB safely, for example? Will this persist forever?

Or do I need to integrate some proper native data storage for each of the platforms (for example, using the cordova-plugin-nativestorage plugin for Cordova, and something similar for Electron)? And if this is the case, what do I do about the Web platform?

like image 792
Danny Connell Avatar asked Oct 15 '22 08:10

Danny Connell


1 Answers

I am not sure if we can count on indexeddb to last forever, but I checked the W3C Recommendation for Indexed Database API 2.0 and it seems to be thriving. The editors are from Google and Microsoft, which is a good sign (except from the viewpoint of those who don't like the influence of the Big Four in the open source world).

Also, while the GitHub issues repo doesn't get a lot of activity, it does seem to be up-to-date with posted issues getting multiple input. I was also impressed that more of the issues were feature requests rather than bug reports or requests for help.

So while we can't be sure how long it will be around, at least in the short-term the prospects look good.

It's also very well supported in all modern browsers except Opera. See: https://caniuse.com/#feat=indexeddb

like image 172
sanitycheck Avatar answered Oct 21 '22 04:10

sanitycheck