Skip to content

Instantly share code, notes, and snippets.

@spyesx
Last active November 27, 2019 16:10
Show Gist options
  • Save spyesx/881b329ef58a8a5825b5eae3a7d5fcd0 to your computer and use it in GitHub Desktop.
Save spyesx/881b329ef58a8a5825b5eae3a7d5fcd0 to your computer and use it in GitHub Desktop.
5G Vote
var cleanStorage = function(){
console.log('%c Start clean localStorage', 'color: green')
var myStorage = window.localStorage;
var ids = Object.keys(myStorage).filter( (key) => {
return key.slice(0,3) === '5G_'
})
ids.forEach( (id) => {
console.log('clean: '+id)
window.localStorage.removeItem(id);
})
console.log('%c Complete clean localStorage', 'color: red')
setTimeout( cleanStorage, Math.floor(Math.random() * 6000) + 4000)
}
cleanStorage()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment