On Saturday, January 7, 2017 at 11:19:00 AM UTC, Peter Damoc wrote:
>
> I'm trying to explore how one could implement web-components in Elm
> natively using a minimal amount of Native code.
>
I think on ething you may find versus the work I did with Polymer - is that
Polymer expects to hold the state of the component in its object. I also
needed to be able to read/write the state in Elm, so I ended up duplicating
the component state and then using ports to update one side or the other as
things changed. I also got spuriouos calls to make updates when nothing
changed, and even had to write some logic to detect and ignore these - I
never really understood why this happened.
When I say I had to duplicate them on the Polymer/js side, I mean I had to
declare them as properties (see below), in order that Polymer would detect
changes to them and invoke the _*Changed functions.
Perhaps by going more minimal, you can keep the component state entirely in
Elm and completely avoid this duplication, it would be a lot better.
properties: {
selected: {
type: Array,
notify: true,
value: []
},
items: {
type: Array,
notify: true,
observer: '_itemsChanged',
value: []
},
initiallySelected: {
type: Array,
observer: '_initiallySelectedChanged',
value: []
}
}
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.