On Monday, October 10, 2016 at 11:01:54 PM UTC+1, Richard Feldman wrote:
> Has anyone gotten anything doing really complicated DOM stuff (in 
> particular Google Maps comes to mind) working in Elm via web components?
> In theory it would Just Work, but in practice I always wonder... ;)

I have not yet encountered any scenarios yet where Elm updates to the DOM 
destroy the state of the component. I have been slightly surprised by this, 
given previous discussion around Html.Keyed and where it is sometimes 
needed. I guess Elm mostly is doing a good job of only making changes to 
the DOM that it really needs to. The actual complexity of the compnent 
should not be an issue, it is a 'shadow' encapsulated piece of the DOM 
after all.

I'm interested in expanding on the counter example to add more complexity - 
and I have a component in mind that will be useful to me - the listbox that 
I was working with previously.

The areas to add more complexity to are:

More complex data on initialization - for example, passing a list of items 
to init the list box with. This will be a List (String, String) in the Elm 
application -> json array of string, string -> List (String, String) in the 
Elm component. That is, just needs encoder/decoder written to handle it.

More complex data on update - same as above really, provide a list of 
selected items every time it changes.

More complex internal state on the component - more options on the 
component for things like max items to display before adding a scroll bar, 
the scroll bar and scroll state itself. Ability to fetch the list of items 
from the server, so I can configure a listbox like this <elm-listbox 
href="http:/.../picklists/somelist">, and have the component manage the 
request/response lifecycle itself.

It looks doable and should add up to a meatier example than the counter.

You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to