Last active
December 2, 2017 17:10
-
-
Save arackaf/a99db3f8e352b02dcc4403f7dfeede90 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| async function preCacheBookImage(book) { | |
| let smallImage = book.smallImage; | |
| if (!smallImage) return; | |
| let cachedImage = await caches.match(smallImage); | |
| if (cachedImage) return; | |
| if (/https:\/\/s3.amazonaws.com\/my-library-cover-uploads/.test(smallImage)) { | |
| let cache = await caches.open("local-images1"); | |
| let img = await fetch(smallImage, { mode: "no-cors" }); | |
| await cache.put(smallImage, img); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment