Re: [w3c/ServiceWorker] Service Worker makes AJAX Progress Listener not Working (#1141)

Hi wanderview,

thanks for the answer. Yeah, I think I know the answer. It is because of the fetch API in my SW.

service-worker.js (Fetch Section)
```
self.addEventListener('fetch', function(event) {
  console.log('Handling fetch event for', event.request.url, version);

  event.respondWith(
    caches.match(event.request).then(function(response) {
      if (response) {
        //console.log('Found response in cache:', response);
        return response;
      }
      //console.log('No response found in cache. About to fetch from network...', event.request.url);

      return fetch(event.request).then(function(response) {
        //console.log('Response from network is:', response);
        return response;
      }).catch(function(error) {
        console.error('Fetching failed:', error);
        throw error;
      });
    })
  );
});
```

-- 
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/1141#issuecomment-301794613

Received on Tuesday, 16 May 2017 14:11:41 UTC