Created
May 9, 2017 15:02
-
-
Save magnucki/e3e21877bb04bcfd9a3b6a2f8938ec80 to your computer and use it in GitHub Desktop.
Store objects in local storage
This file contains hidden or 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 JSON.parse(this.getItem(key)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment