Created
March 20, 2025 21:41
-
-
Save netlooker/04ee8b68cb47c866708a5d2c2f503899 to your computer and use it in GitHub Desktop.
Clear Cache of PWA
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
// Clear caches | |
caches.keys().then(cacheNames => { | |
return Promise.all( | |
cacheNames.map(cacheName => { | |
console.log(`Deleting cache: ${cacheName}`); | |
return caches.delete(cacheName); | |
}) | |
); | |
}).then(() => { | |
console.log('All caches cleared'); | |
console.log('Reloading page in 2 seconds...'); | |
setTimeout(() => window.location.reload(true), 2000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment