Do you only need to keep track of it in the browser’s local storage? Or do you want it to be available across different browsers?
For local storage, I wrap https://github.com/localForage/localForage (I only wrap a tiny part of the API, just get and set basically). I originally wrote a library to do this: https://github.com/bloom/reason-browser-persist, but I don’t use it anymore, because the external
code necessary to wrap the API that I need is so small.
If you want persistence across browsers / computers firebase is a great way to go. I’ve been working a lot with firebase lately, and though there’s the library @Ebuall mentioned that exists, I’ve written my own wrappers for firebase, initially because I needed to use APIs that weren’t covered in bs-firebase
, and because I wanted to experiment with different approaches to wrapping the calls.
It’s unfortunate that using external
to wrap things takes a non-trivial bit of work to understand, and that it’s one of the most important things to understand when starting out if you want to be productive right away in a Javascript world. Maybe that can get better in the future. But as it stands right now, I’d recommend taking the time to get comfortable with external
, and use it as often as you need. (just be very careful that the wrappers your writing reflect the real values coming through. External code is a ripe source of baffling bugs)