hubber-memory-game
hubber-memory-game copied to clipboard
Save the hubbers in localstorage
We're now making API requests to GitHub API: max 60 requests / hour. A nice improvement would be to store the hubbers list in browser's localStorage and try to update it every time (just in case new hubbers are appearing).
- Check if the
localStoragecontains hubbers - Try to update the
localStorageinfo. - If 1 and 2 failed, take the hubbers from our file.
:dizzy:
@IonicaBizau oh interesting, I've never heard of localStorage before.
https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
@alysonla Yep, it's a nice browser feature. :sparkle:
Basically you can do something like:
// To set the data
localStorage.setItem("hubbers", JSON.stringify([/* wonderful people */]);
// To get the data
JSON.parse(localStorage.getItem("hubbers"));