- From: tomasgil123 <notifications@github.com>
- Date: Sun, 29 Nov 2020 11:54:49 -0800
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Sunday, 29 November 2020 19:55:04 UTC
Hi guys, does anyone know how to import scripts in the service worker while being offline? I tried caching the resource I want to import, but is not working :/ ``` async function getIdb() { if (typeof idb === 'undefined') { try { self.importScripts('https://cdn.jsdelivr.net/npm/idb@5.0.7/build/iife/with-async-ittr-min.js') } catch (err) { console.log('err idb') const cache = await caches.open(STATIC_CACHE_NAME) const cacheIdb = await cache.match( 'https://cdn.jsdelivr.net/npm/idb@5.0.7/build/iife/with-async-ittr-min.js' ) self.importScripts(cacheIdb) } } } getIdb() ``` Any ideas? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/ServiceWorker/issues/1555
Received on Sunday, 29 November 2020 19:55:04 UTC