In progress. May eventually become a storage abstraction layer.
A JavaScript module that wrappers the HTML5 localStorage object. It can optionally store objects serialised in a JSON string. This code is based on a early jQuery.localStorage plugin by Stoimen. Main differences are separating out the JSON dependency, decoupling from jQuery, and some optimisation.
Dependencies: localStorage and JSON if you are storing objects. If you really need non-native JSON and its not native then use Doug Crockford's JSON.js.
Will fire a console.warn (if console enabled) if you attempt to store an object when JSON is not supported.
localStore.setItem(name, itemData, lifetimeMsec);
// itemData can be Sting, Number, Object or Array
// lifetimeMsec is an optional value in msec (default 1 hour)
// returns true if successful
localStore.getItem(name);
// returns the itemData or null if expired, false on failure
localStore.removeItem(name);
// returns true if successful
Licenced under CC-BSD 2011, John Hunter http://creativecommons.org/licenses/BSD/
LocalStore is derived from jQuery.localStorage by Stoimen 2010