Created
September 11, 2022 16:04
-
-
Save Ivannnnn/11c9f41bfc548bbaecc536c71d0930a2 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
const getCacheAll = async (name, q) => { | |
const cache = await caches.open(name); | |
return cache.matchAll(q); | |
}; | |
const logText = (matches) => | |
Promise.all(matches.map((r) => r.text().then((txt) => [r.url, txt]))); | |
async function clearCache(name) { | |
const cache = await caches.open(name); | |
const matches = await cache.matchAll(); | |
return Promise.all(matches.map((match) => cache.delete(match.url))); | |
} | |
// | |
(async () => { | |
//await clearCache('job-tracker') | |
const result = await logText(await getCacheAll("job-tracker")); | |
console.log(result); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment