

HTML5-ish window.remoteStorage with openkeyval.js - markchristian

Howdy, Hackers;
Last week, dustball and I announced OpenKeyval.org here (http://news.ycombinator.com/item?id=1846088), and we got some great feedback. One thing we heard from a few people was a desire for it to be easier to work with from JavaScript. That was something I was very happy to hear, since this idea came out of my own brainstorming around making server-less web apps that could still have non-local state.<p>With that in mind, I'd like to introduce openkeyval.js, which offers an interface to OpenKeyval.org that's vaguely modeled after HTML5's local storage.<p>// Here's how you set a value
window.remoteStorage.setItem('location', 'the couch', optionalCallbackFunction);<p>// Here's how you retrieve a value
window.remoteStorage.getItem('location', function(value, key) {
  alert('The value of ' + key ' + is ' + value);
});<p>Take a look at the site for more details and a link to the code. We're hosting a minified version on a CDN (incidentally, http://maxcdn.com is pretty awesome), so you can feel free to link directly to it from your sites with a reasonable expectation of reliability and speed.<p>As always, thanks for reading and please let us know what you think.<p>PS: This is definitely a first revision. Although it has memoization, it doesn't have any provision for local caching, and it can only get/set one item at a time -- basically, there is definitely a lot of room for performance improvements.
======
markchristian
Clickable link: <http://openkeyval.org>

