Created
March 11, 2018 21:28
-
-
Save ritikrishu/5e7986416acefed5f70048adc363b730 to your computer and use it in GitHub Desktop.
searching for an entry in CacheStorage
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
/** | |
Suppose, origin has caches named "wittr-static-v8" and "wittr-content-imgs" | |
"wittr-content-imgs" contains a request response pair for craig.jpg, | |
with request url as key i.e. "avatars/craig" | |
*/ | |
console.log( | |
await caches.match("avatars/craig") | |
)//👇 | |
/** | |
body: (ReadableStream) | |
bodyUsed: false | |
headers: Headers {} | |
ok: true | |
redirected: false | |
status: 200 | |
statusText: "OK" | |
type: "basic" | |
url: "http://localhost:8888/avatars/craig.jpg" | |
__proto__: Response | |
*/ | |
console.log( | |
await caches.match("avatars/craig", {cacheName: "wittr-static-v8"}) | |
)// <- undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment