I need to know how to send to the client which request is failing to be fetched in:
self.addEventListener('install', async ()=>{
event.waitUntil(caches.open(CACHE_NAME).then((cache)=>
cache.addAll(urlsToCache)
));
});
I need to receive It in the client. Something like:
//client.js
var reg=Navigator.serviceWorker.register('sw.js');
Navigator.serviceWorker.onerror=(ev)=>{
document.getElementById('err1').textContent = ev.data.message;
}
// sw.js
self.addEventListener('install', async (ev)=>{
event.waitUntil(caches.open(CACHE_NAME).then((cache)=>
cache.addAll(urlsToCache)
).catch((err)=>{
var client = clients.get(ev.clientId); // ev does not have clientId
client.postMessage(err.offendingRequest); // offendingRequest does not exist
}));
});