-
Notifications
You must be signed in to change notification settings - Fork 829
New issue
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
way to have the progress bar while service worker is doing its magic #2498
Comments
Writing a There's a plan for Workbox v6 to make this interface feel more like associating a plugin with any other strategy, instead of having to call the precaching-specific I don't personally have an example to share of using a |
Q1) I guess if I import Q2) Let's say i have 5 items in a manifest. So when user first enters the website, |
|
Library Affected:
workbox-sw, workbox-build, etc.
Hi @jeffposnick
I am looking for a graceful way to show a progress bar while service worker is doing its precache. (This essentially means - while service worker is installing)...
The way I handle/Solve this now: Right now, What I do is put workbox's generated manifest in my
app.js
file too and loop through this there , making requests for them and having the progress bar . After i make requests for all the assets present in manifest, Then i register service worker which essentially starts installing. As soon as I register my service worker, I remove progress bar and service worker runs in background (because I already made requests for manifest entries in myapp.js
, service worker doing the same thing will get those assets from http cache) and this is how I have my app.When user enters the site for 1st time, we say:
installing app
. If user enters the site for 2nd time, we sayloading app
. If code updated and user clickeddownload new version
button, we sayupdating app
.The way I want to have: I am thinking of removing looping through manifest and making requests for them in my
app.js
file. and only have the assets downloaded in service worker's install event. I also want to haveinstalling, updating, loading
words below progress bar.I found : https://developers.google.com/web/tools/workbox/guides/using-plugins . On this link, there's
custom plugins
and we have different hooks (cacheDidUpdate
and many others).To even start addressing this problem, we will need to know when:
precaching
starts. (first event which gets called only once at the beginning)cacheDidUpdate
,cacheWillUpdate
,cacheKeyWillBeUsed
, many others), still couldn't find the correlation between these events to accomplish what I want. Some of them might break something as I am using different cache strategies in my service worker and who knows what it will break... One of the actual thing is if user enters the site for 2nd time,cacheDidUpdate
orcacheWillUpdate
won't get called.cachedResponseWillBeUsed
might get called - maybe.Have you thought about this problem and if there's anyone who has a working demo or maybe can confirm that it's doable with these hooks?
The text was updated successfully, but these errors were encountered: