Created
July 26, 2011 10:02
-
-
Save colmjude/1106417 to your computer and use it in GitHub Desktop.
Extends the Local Storage Object to accept and retrieve objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Storage.prototype.setObject = function(key, value) { | |
this.setItem(key, JSON.stringify(value)); | |
}; | |
Storage.prototype.getObject = function(key) { | |
return this.getItem(key) && JSON.parse(this.getItem(key)); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment