Last active
November 29, 2022 18:51
-
-
Save JeffreyPalmer/09b7d95221de8059bd9ff37176b9313c to your computer and use it in GitHub Desktop.
Code to save fxhash hashes in local browser storage
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<script> | |
// Put the following code into your index.html | |
// Store previous hashes | |
const storedKeys = JSON.parse(localStorage.getItem('fxhashes')) || []; | |
if (!storedKeys.includes(fxhash)) { | |
storedKeys.length >= 10 && storedKeys.shift(); | |
storedKeys.push(fxhash); | |
localStorage.setItem('fxhashes', JSON.stringify(storedKeys)); | |
} | |
localStorage.setItem('prevHash', localStorage.getItem('fxhash')); | |
localStorage.setItem('fxhash', fxhash); | |
</script> | |
</head> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment