DEV Community

Saad Saif
Saad Saif

Posted on

3 3

PWA empty fetch callback

If you have the empty fetch call back in service worker, PWA will no longer be installable from august 2021.

You have to respond with custom response in fetch request, check if request is in cache then send file from cache else proceed with request

self.addEventListener('fetch', (evt) => {
  evt.respondWith(
    caches.match(evt.request).then((cacheRes) => {
      return cacheRes || fetch(evt.request)
    })
  )
})
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more