Created
August 3, 2017 13:08
-
-
Save igorfelipee/7cbbc825318a7c57ba9648807ab0bb8d to your computer and use it in GitHub Desktop.
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
function save_data(data, id) { | |
if (!window.localStorage || !window.JSON || !id) { | |
return; | |
} | |
window.localStorage.setItem(id, JSON.stringify(data)); | |
} | |
function get_data(key) { | |
console.log("getting data"); | |
if (!window.localStorage || !window.JSON || !key) { | |
console.log('Erro'); | |
return; | |
} | |
if (!window.localStorage.getItem(key)) { | |
return; | |
console.log("!item"); | |
} | |
return window.localStorage.getItem(key); | |
} | |
export { save_data, get_data }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment