1
Fork 0
mirror of https://github.com/Steffo99/steffoweb.git synced 2024-11-22 08:04:31 +00:00
steffoweb/docs/sw-debug.js
2020-06-30 19:13:48 +02:00

21 lines
775 B
JavaScript
Vendored
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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) {
// eslint-disable-next-line
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 {
// eslint-disable-next-line
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;
})
);
});