Re: [WICG/webcomponents] Allow customElementRegistry definitions to persist across page loads (Issue #1033)

I was initially thinking this would allow storing element *instances* and re-using them across page loads (having their `adoptedCallback`s be called once placed into the document across the other side of a page load).

This would require some semantics of Service worker, with considerations for how to bust the cache on app updates. Maybe a ServiceWorker would even be responsible for this, like maybe it would manage a pool of elements. Maybe it would only be position if an element does not reference anything from its previous Realm, and only grabs things from the new `document` at `adoptedCallback` time, otherwise the element would simply be GC'd and would not reach the SW's pool. Upon new page load, when a new element is instantiated on the main thread, the engine can return an element of matching class provided by the SW. A SW could also persist some elements while the app isn't even open, ready for later.

Totally just imagining here, not really sure how feasible this is, but the idea seems interesting.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/1033#issuecomment-1744091710
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/1033/1744091710@github.com>

Received on Tuesday, 3 October 2023 03:06:32 UTC