I have already tried doing this but have run into troubles:

Here is the topic where I have the code and the problem:
https://groups.google.com/forum/#!topic/elm-discuss/QI6G6Pd5jPU




On Mon, Oct 10, 2016 at 4:49 PM, 'Rupert Smith' via Elm Discuss <
[email protected]> wrote:

> On Monday, October 10, 2016 at 2:20:57 PM UTC+1, Rupert Smith wrote:
>>
>> On Monday, October 10, 2016 at 2:14:55 PM UTC+1, Rupert Smith wrote:
>>>
>>> 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.
>>>
>>
>> I've forked the elm-polymer code to here to use as a starting point for
>> trying the above:
>>
>> https://github.com/rupertlssmith/elm-polymer
>>
>
> Another aspect to this would be for there to be some way for the
> application using the component to pass some initial/configuration values
> to the component, when creating it. So add a property to the component that
> can be set to some initial value of the counter.
>
> counter [ count 100, oncountchanged Count ]
>
> Might also look at how an function could be added to the API of the
> counter to set it to a particular value at a later time too.
>
> setCount: Int -> Cmd msg
>
> --
> 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.
>



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
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.

Reply via email to