service-worker-dev.js 796 B

1234567891011121314151617
  1. // This service worker file is effectively a 'no-op' that will reset any
  2. // previous service worker registered for the same host:port combination.
  3. // In the production build, this file is replaced with an actual service worker
  4. // file that will precache your site's local assets.
  5. // See https://github.com/facebookincubator/create-react-app/issues/2272#issuecomment-302832432
  6. self.addEventListener('install', () => self.skipWaiting());
  7. self.addEventListener('activate', () => {
  8. self.clients.matchAll({ type: 'window' }).then(windowClients => {
  9. for (let windowClient of windowClients) {
  10. // Force open pages to refresh, so that they have a chance to load the
  11. // fresh navigation response from the local dev server.
  12. windowClient.navigate(windowClient.url);
  13. }
  14. });
  15. });