Skip to content

Instantly share code, notes, and snippets.

@magnucki
Created May 9, 2017 15:02
Show Gist options
  • Select an option

  • Save magnucki/e3e21877bb04bcfd9a3b6a2f8938ec80 to your computer and use it in GitHub Desktop.

Select an option

Save magnucki/e3e21877bb04bcfd9a3b6a2f8938ec80 to your computer and use it in GitHub Desktop.
Store objects in local storage
Storage.prototype.setObject = function(key, value) {
this.setItem(key, JSON.stringify(value));
}
Storage.prototype.getObject = function(key) {
return JSON.parse(this.getItem(key));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment