worker: fix crash due to caches (fix #588)

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/602/head
Varun Patil 2023-04-19 13:42:38 -07:00
parent 3113b0041e
commit f1834e31ba
1 changed files with 4 additions and 4 deletions

View File

@ -22,11 +22,11 @@ const pendingUrls = new Map<string, BlobCallback[]>();
// Cache for preview images
const cacheName = "images";
let imageCache: Cache;
caches
.open(cacheName)
self.caches
?.open(cacheName)
.then((c) => (imageCache = c))
.catch(() => {
/* ignore */
.catch((e) => {
console.warn("Failed to open cache in worker", e);
});
// Expiration for cache