Quote:
Originally Posted by RickP
They can create a "new" local storage concept that is async. Leave the old one in place. Or better yet just extend the new one so it's still backwards compatible.
|
how can one provide backwards compat to code expecting a sync interface to one expecting a callback? you can catch the writes, but there would be no way to load.
i have not had time to make my fully unified script, i've been in the middle of a launch the past week. I was going to squeeze the heck out of the polyfill, add deflate(), a localStorage[]-fallback, and an ajax plugin to allow for unlimited storage using a server backend through the unified interface. those aren't that complicated or lofty of implementation ideals, but i've just not had time. maybe you can polish it up.
here is a unified indexedDB/webSQL package, which was/is to be the core of my tool. it should provide at lease 5 more megs. In FF, i think its 50mb, in chrome it actually varies, and in IE10 i think its 5 megs, but that's unconfirmed.
The websql polyfill provides an indexed DB api to a higher-leven abstractino script i'd found. I tried to code all the low-level stuff myself, but after 4 or 5 hours of banging my head against browser quirks, stale docs, and invisible errors, i gave up.
anyway, it's is tested in IE10, FF, Ch, and Op.
http://danml.com/js/localstorage2.js
the api is one function, overloaded by arguments according to task.
usages:
Code:
function dump(e){ console.info(e); }
//load
localStorage2( "lastName", dump );
//save
localStorage2( "lastName", "smith" ); // OR:
localStorage2( "lastName", "smith", dump );
//list
localStorage2( dump );
//delete
localStorage2( "DELETE", "lastName", dump );
i'll still work on it one day, but here's what i got to build on.
right now, it's not a bad way to store in webworker threads, since localStorage is blocked in those...