Last active
September 29, 2017 20:42
-
-
Save julianwinkel/4c90840ad1663dc82fea89a0e9effe53 to your computer and use it in GitHub Desktop.
super simple localStorage wapper. Store variables with types
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
// https://stackoverflow.com/a/13442834 | |
var myLocalStorage = { | |
set: function (item, value) { | |
localStorage.setItem( item, JSON.stringify(value) ); | |
}, | |
get: function (item) { | |
return JSON.parse( localStorage.getItem(item) ); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment