-
Notifications
You must be signed in to change notification settings - Fork 294
Trigger asset caching from boot #1623
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
Conversation
@adamziel @brandonpayton I'm exploring how to trigger What do you think about this approach? Do you have any other suggestions on how to do it? Context:
WebWorkers and ServiceWorkers can't communicate directly, so messages need to be relayed through the main thread. Alternatively we could skip |
This doesn't work for me. The Web Worker isn't loaded on the first load so it doesn't relay the message to the service worker. |
I will focus on wrapping up offline support without triggering it from boot and we can explore this next week. |
Let's trigger fetch from boot to cache assets. |
The current implementation in #1535 seems good as is. Let's close this PR without merging. |
Motivation for the change, related issues
We would like for Playground boot to control all aspects of the boot process including offline asset caching.
To do this we need a way to communicate between
bootPlaygroundRemote
and the service worker.Implementation details
worker-thread.ts
can now triggercacheOfflineModeAssets
which allowsbootPlaygroundRemote
to control offline asset caching.cacheOfflineModeAssets
now usesfetch
instead of callingcache.addAll
directly.Because we call
cacheOfflineModeAssets
from the end of the boot process, caching is already working and all requests are cached.If any of the files were already cached, they would be returned by cache instead of making a network request.
Testing Instructions (or ideally a Blueprint)