new "cachedResponseIsAbsent" method for custom plugins
Feature Request Description:
I would like to request for a new method for custom plugins called "cachedResponseIsAbsent" for example.
What is the use case? To be informed if no cached response was found and the request will have to solely depend on a fetch. Indeed, when requestWillFetch is fired within a StaleWhileRevalidate strategy plugin, we still do not know if a cached response will be found. Our service worker is using client.postMessage() to inform the client of these different events so as to fine-tune the UX. The only solution for now seems to set a timeOut after receiving a message from requestWillFetch to see if cachedResponseWillBeUsed will also fire just after. Instead, it would be easier to have a "cachedResponseIsAbsent" message the client.
In our specific case: If cachedResponseWillBeUsed fires after requestWillFetch fires, we show the cached content + an "updating" message If cachedResponseIsAbsent fires instead after requestWillFetch fires, there is no cached content to display so we instead show some placeholders without any updating message.