From b223acfc7436fd2107c31d2e0f87768823377d4c Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Mon, 21 Feb 2022 11:19:10 -0500 Subject: [PATCH] Clean up debug code --- src/sw.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/sw.js b/src/sw.js index 391f3a5d..331fc2a5 100644 --- a/src/sw.js +++ b/src/sw.js @@ -54,12 +54,11 @@ const cacheKey = 'pleroma-fe' const cacheFiles = self.serviceWorkerOption.assets const emojiCacheKey = 'pleroma-fe-emoji' const isEmoji = req => { - console.log('req.method=', req.method) if (req.method !== 'GET') { return false } const url = new URL(req.url) - console.log('pathname=', url.pathname) + return url.pathname.startsWith('/emoji/') } @@ -108,14 +107,12 @@ self.addEventListener('notificationclick', (event) => { }) self.addEventListener('fetch', (event) => { - console.log(`[Service Worker] Got: ${event.request.url}`) - console.debug(event.request) // Do not mess up with remote things const isSameOrigin = (new URL(event.request.url)).origin === self.location.origin if (shouldCache && event.request.method === 'GET' && isSameOrigin) { event.respondWith((async () => { const r = await caches.match(event.request) - console.log(`[Service Worker] Fetching resource: ${event.request.url}`) + if (r) { return r } @@ -123,13 +120,11 @@ self.addEventListener('fetch', (event) => { try { const response = await fetch(event.request) if (response.ok && isEmoji(event.request)) { - console.log(`[Service Worker] Caching emoji ${event.request.url}`) const cache = await caches.open(emojiCacheKey) await cache.put(event.request.clone(), response.clone()) } return response } catch (e) { - console.log('error:', e) throw e } })())