On Tue, Jan 10, 2017 at 10:27 AM, 'Rupert Smith' via Elm Discuss < [email protected]> wrote: > > Do you want to set the label when the component is created, or at a later > time? To do it at create time, set an attribute or property on the componet: > > <my-button label="press me"/> >
There is no difference in my mind between "at creation" and "later time" because of how elm-html works. >From an API point of view, you will always use something like myButton [label "press me"] [] In JS you can have a component created and then mutate one of its properties. "at creation" and "later time" are more relevant there because of the imperative nature of JS. In Elm, everything is declarative. If behind the scenes, the runtime updates some property instead of recreating the entire node, that's an implementation detail. > And to receive custom events, you are going to set up an 'on' handler? > > myButton [ on "custom-event" CustomEvent ] [] > > Yes, that's the idea (with the small addendum that modules that define components should also provide custom functions for the events and not force raw "on" handlers on the consumer of the module). In order for an event like this to happen, the runtime has to trigger it somehow based on something that happens in the component. -- 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.
