1
Fork 0
mirror of https://github.com/Steffo99/unisteffo.git synced 2024-11-22 16:04:21 +00:00
triennale-appunti-steffo/docs/sw-debug.js

22 lines
775 B
JavaScript
Raw Normal View History

2020-03-01 20:25:46 +00:00
self.addEventListener('fetch', function(event) {
var isPostRequest = event.request.method === 'POST';
event.respondWith(
fetch(event.request).catch(function(err) {
if (err instanceof TypeError) {
if (isPostRequest) {
2020-03-11 18:23:38 +00:00
// eslint-disable-next-line
2020-03-01 20:25:46 +00:00
console.log(
'⚛Preact CLI development tip: A POST request just failed. This might fail for your users as well due to a network error. It may be worth exploring the backgroundSync API.'
);
} else {
2020-03-11 18:23:38 +00:00
// eslint-disable-next-line
2020-03-01 20:25:46 +00:00
console.log(
'⚛Preact CLI development tip: A GET request just failed. This might fail for your users as well due to a network error. It may be worth adding runtimeCaching to your Service Worker.'
);
}
}
return err;
})
);
});