We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm trying workbox and service-worker for the first time today.
I'm using the stale-while-revalidate strategy with workbox-broadcast-update's BroadcastUpdatePlugin.
stale-while-revalidate
workbox-broadcast-update
BroadcastUpdatePlugin
Everything works:
the browser starts a call
the Service Worker with Workbox return the cached response and starts a revalidation call
if the revalidation response is different I get a message! Great!
What I don't know is how to receive an event even if there is NO UPDATE from the revalidation call.
This is the code I'm using:
importScripts( "https://storage.googleapis.com/workbox-cdn/releases/7.1.0/workbox-sw.js" ); self.skipWaiting(); workbox.core.clientsClaim(); workbox.routing.registerRoute( ({ url }) => url.pathname.startsWith("/images/avatars/"), new workbox.strategies.StaleWhileRevalidate({ plugins: [new workbox.broadcastUpdate.BroadcastUpdatePlugin()], }) );
I would like something like this:
workbox.routing.registerRoute( ({ url }) => url.pathname.startsWith("/images/avatars/"), new workbox.strategies.StaleWhileRevalidate({ plugins: [new workbox.broadcastUpdate.BroadcastUpdatePlugin({ callback: (response) => { if (response.isNew()) { const message = {}; sendMessageToClient(message); } } })], }) );
Is there a way?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm trying workbox and service-worker for the first time today.
I'm using the
stale-while-revalidate
strategy withworkbox-broadcast-update
'sBroadcastUpdatePlugin
.Everything works:
the browser starts a call
the Service Worker with Workbox return the cached response and starts a revalidation call
if the revalidation response is different I get a message! Great!
What I don't know is how to receive an event even if there is NO UPDATE from the revalidation call.
This is the code I'm using:
I would like something like this:
Is there a way?
The text was updated successfully, but these errors were encountered: