On Sunday, October 9, 2016 at 9:41:46 PM UTC+1, Peter Damoc wrote: > > The only thing that remained to be shown with code is how to implement a > component in Elm and use it in Elm (yo, dawg style) . >
Like this: Take the polymer-elm counter examples. Produce an elm counter. Wrap this as a webcomponent (without polymer). This will expose just 1 event, which is an update every time the counter value changes. The up/down events are hidden to the outside and only dealt with by the counter program internally. This will expose just 1 data value, an Int giving the counter value. It would be interesting to expose more complex data structures, but this is a starting point. Produce a minial API in Elm to interface to this webcomponent. It provides an 'oncountchanged' Property to its Html constructor, that takes an Int -> Msg argument, so that it can be set up to trigger an event with the new value when the counter is clicked. Write a little Elm program to make use of this counter. All the Elm code for the counter and the consuming program to be compiled together into 1 .js with 2 mains, to maximize code sharing. -- 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.
