- From: Dino Reić <notifications@github.com>
- Date: Thu, 13 Feb 2025 13:28:53 -0800
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 13 February 2025 21:28:57 UTC
dux left a comment (WICG/webcomponents#551)
I now have relatively complex setup on many projects, involving generating custom components from two sources, Svelte + some custom component FW.
What works great for me, now for years is
* unless sure, execute connect with my object in `window.requestAnimationFrame`
* if I am sure, I mark my components as safe to fast load, aka that have and do not use children in `<slot />` in any way.
That provides fast load, with 0 shake 99% of the time. I know somebody said somewhere that this is not safe, but I assure you it is great and works in all major browsers today without any problems.
Example pseudo
```
customElements.define(name, class extends HTMLElement {
connectedCallback() {
if (fastRenderEnabled(this, klass)) {
connectDom(this)
} else {
window.requestAnimationFrame(()=>{
connectDom(this)
})
}
}
```
--
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/551#issuecomment-2657747254
You are receiving this because you are subscribed to this thread.
Message ID: <WICG/webcomponents/issues/551/2657747254@github.com>
Received on Thursday, 13 February 2025 21:28:57 UTC