Not-a-web-developer-question: Would it make sense to add a module that replicated the localStorage data 'upstream' or somewhere, something like an rsync.net copy that could be sync'ed by the user before they blow the cache?
It could be very neat, but there are very few projects that would interested in it. localStorage is persistent enough for small hobby projects like this, and for something more serious you'd like to have some kind of backend DB anyway.
Not really. For instance, with TiddlyWiki you can run a local server and save everything on disk in a single html file. Jumping from localStorage to a DB means you go straight from "only in one browser" to having to deal with the overhead of a DB. A single text file has the advantage that you can drop it in a repo and have it version controlled or keep it in a Dropbox folder and use it on multiple computers/share it with others.
Oh I don't know. A serious dev team might want to be able to use their kanban on an airplane. An individual might want automated backup, while being able to code in a park or on the beach.
I'm surprised no one is mentioning IndexedDB [0]
Seems like a well-supported [1] document database built into the browser would beat LocalStorage in almost every way. That's what I've found in my experience at least.
It survives pretty well. I built a super basic localStorage only web app and it's worked really well. Until I switched phones and realized I didn't add export functionality.
I simply added a local storage inspector bookmark to my chrome profile, so it gets sync to all devices. Now on any page, I just need to type its name, it will appear in dropdown, & clicking it exports all local storage used by current page or ___domain as json file.
Code of bookmarklet:
javascript:(function() { var backup = {}; for (i = 0; i < localStorage.length; i++) { var key = localStorage.key(i); var value = localStorage.getItem(key); backup[key] = escape(encodeURIComponent(value)); } var json = JSON.stringify(backup); var base = btoa(json); var href = 'data:text/javascript;charset=utf-8;base64,' + base; var link = document.createElement('a'); link.setAttribute('download', 'backup.json'); link.setAttribute('href', href); document.querySelector('body').appendChild(link); link.click(); link.remove();})()