Food for thought: What if the liveview JS client lived in a JS service worker?

Just a random thought I had as I’m learning more about JS service workers.

Would there be any advantage to moving the LV client to a service worker for later initialing?

Or would it be even possible to utilize the service worker as a offline mode proxy for the LV client in some way.
Maybe it just caches the client.

I’ve been thinking a lot about offline mode, or rather whats a good contingency given the app may have that issue.

I do understand the SW does not have access to the dom so I guess it would be some level of abstraction

2 Likes

Hey, i have no answer at the moment but are interested in the thoughts of the community. Maybe reviving this post helps a bit :wink:

I observed recently that the way cars.com is dealing with it by showing some transparent overlay over the whole page, as if suggesting that interactions are disabled.

But well, that’s perhaps a tangent from the main point about Service Workers. I don’t know enough to comment on whether that would be advantageous to LiveView in any way.