Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Web Standards
Web Standards
@webstandards_dev@mastodon.social  ·  activity timestamp 5 days ago

How to dynamically install custom elements. @heydon shows a naming convention, a tiny define() helper, and an install() script that scans :not(:defined), dedupes matches, and dynamically imports only what is used. For dependent components, it can fire a ready event or use a MutationObserver for elements added later. #js #webcomponents

https://heydonworks.com/article/dynamically-loading-custom-elements/

Sketch of the author’s face next to the headline “How to dynamically install custom elements”, with panels showing a JS file tree, custom elements, and JavaScript code.
Sketch of the author’s face next to the headline “How to dynamically install custom elements”, with panels showing a JS file tree, custom elements, and JavaScript code.
Sketch of the author’s face next to the headline “How to dynamically install custom elements”, with panels showing a JS file tree, custom elements, and JavaScript code.
HeydonWorks

How To Dynamically Install Custom Elements

A reusable pattern for custom elements installation
  • Copy link
  • Flag this post
  • Block

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.2-alpha.7 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Members
  • Code of Conduct