Elm with custom elements (cheat sheet)
2020-09-27
When exploring custom elements (often called Web Components) in combination with Elm, the following techniques seemed to be very important to me, and I want to have them easily available for future reference:
Techniques
- Pass stringified data from Elm to the custom element as an HTML attribute (the custom element can watch on changes for these).
- Pass arbitrary JSON (also opaque objects like RTCPeerConnection) from Elm to the custom element
- Pass arbitrary JS data from the custom element to elm using DOM events
I use them also for the elm-conf example, but this post is easier to use as a cheat sheet.
read more