On Wednesday, October 12, 2016 at 3:02:14 PM UTC+1, Rupert Smith wrote:
>
>
> On Wednesday, October 12, 2016 at 1:55:02 PM UTC+1, Peter Damoc wrote:
>>
>> I did however became aware of a big limitation to this approach: ports. 
>>
>> ports seam to be needed in order to implement triggering events in order 
>> to communicate with the outside of the component. 
>>
>
> I'll have to correct you here. The event is triggered by using an on-event 
> on the custom components html element:
>
> onCountChanged : (Int -> msg) -> Attribute msg
> onCountChanged tagger =
>     on "count-changed" <| Decode.map tagger detailCount
>
> This is actually very neat, since ports are not needed.
>
> But the port does need to be used to push the part of the state that the 
> component wants to make public from the Elm program, into the component as 
> javascript, so that it can trigger an on-event to pass it to the consumer 
> of the component.
>

This is an area where compiler integration could help. If there were say a 
special 'program' type for building webcomponents - pushing parts of the 
Elm state out to the component could be boilerplate that is generated. But 
I'll just park this idea for now. 

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