📝 How To Dynamically Install Custom Elements A pattern I’ve been working on for a while. Load just the elements you are actually using. “Tree shaking” is trivial with HTML. heydonworks.com/article/dyna...
16 reposts67 likes
📝 How To Dynamically Install Custom Elements A pattern I’ve been working on for a while. Load just the elements you are actually using. “Tree shaking” is trivial with HTML. heydonworks.com/article/dyna...
16 reposts67 likes
Nice! I did something similar in the WC Toolkit lazy-loader package. If they are defined, it will also load dependencies and will shut off once all components have been loaded. wc-toolkit.com/adoption/laz...
@heydonworks.com I like how minimal this is. You can also move the loading logic into a lazy-load wrapping element, give it a slot for placeholder content, and then outfit it with an intersectionobserver to start loading when scrolled into view.
@heydonworks.com I have something like that in this repo, might be better than an explanation: https://github.com/jsebrech/sweet-suspense That repo also handles loading errors with an error boundary. It was part of an exploration of what it would take to replace the useful bits of react with […]
The self-defining trick is awesome! The modern tech makes much of my earlier approach a lot neater. blog.damato.design/posts/fetchi...