Skip to content

Instantly share code, notes, and snippets.

@abriemme
Last active December 14, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abriemme/5097817 to your computer and use it in GitHub Desktop.
Save abriemme/5097817 to your computer and use it in GitHub Desktop.
HTML5 LocalStorage Array and objects
Storage.prototype.setObj = function(key, obj) {
return this.setItem(key, JSON.stringify(obj));
}
Storage.prototype.getObj = function(key) {
var value = this.getItem(key);
return value && JSON.parse(value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment