You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is for adding support to SW to prefetch resources during onfetch that it knows a controlled page will later request.
Imagine a page at www.example.com/foo/bar that has <image src="bar.png"> or does an XHR to www.example.net/bar. Currently the page must be fetched and parsed before the image or XHR fetch begins. It could be helpful if SW could prefetch the resources in the onfetch handler for "/foo/bar", and return the response (possibly an in-progress stream) in the onfetch handler for "bar.png" or /bar".
One idea is to use the cache for this:
// in onfetch for /foo/barcache.add('bar.png');// in onfetch for bar.pngevent.respondWith(cache.match('bar.png'));
But as currently spec'd, the .match call wouldn't succeed until the request initiated by the .add call completes.
Is there another way of supporting this use case?
The text was updated successfully, but these errors were encountered:
The .match promise in the example will resolve with an incumbent record, if there has been any, even before .add promise resolves. Or, if there has been no incumbent record, it will return the in-flight fetching record. The fulfillment of .add promise makes the resource be the new incumbent record for the next request.
This issue is for adding support to SW to prefetch resources during onfetch that it knows a controlled page will later request.
Imagine a page at www.example.com/foo/bar that has
<image src="bar.png">
or does an XHR towww.example.net/bar
. Currently the page must be fetched and parsed before the image or XHR fetch begins. It could be helpful if SW could prefetch the resources in theonfetch
handler for "/foo/bar", and return the response (possibly an in-progress stream) in theonfetch
handler for "bar.png" or /bar".One idea is to use the cache for this:
But as currently spec'd, the
.match
call wouldn't succeed until the request initiated by the.add
call completes.Is there another way of supporting this use case?
The text was updated successfully, but these errors were encountered: