noopServiceWorker.js 860 B

1234567891011121314151617181920212223
  1. /* eslint-disable-next-line no-redeclare */
  2. /* global self */
  3. // This service worker file is effectively a 'no-op' that will reset any
  4. // previous service worker registered for the same host:port combination.
  5. // It is read and returned by a dev server middleware that is only loaded
  6. // during development.
  7. // In the production build, this file is replaced with an actual service worker
  8. // file that will precache your site's local assets.
  9. self.addEventListener('install', () => self.skipWaiting())
  10. self.addEventListener('activate', () => {
  11. self.clients.matchAll({ type: 'window' }).then(windowClients => {
  12. for (const windowClient of windowClients) {
  13. // Force open pages to refresh, so that they have a chance to load the
  14. // fresh navigation response from the local dev server.
  15. windowClient.navigate(windowClient.url)
  16. }
  17. })
  18. })