Op vrijdag 18 november 2016 10:12:29 UTC+1 schreef Tim Bezhashvyly:
>
> I was looking into https://github.com/simonh1000/elm-google-maps-2
>

At quick glance, that one has a somewhat peculiar elm setup:

   - init returns a startup model (a loading state) + a Tick time command
   - the model with loading state will be passed (by elm) to the view
   - at the same time, elm will do the Tick command and pass that to the 
   update function
   - the update function then outputs an unchanged model + a Loadmap command
   - as soon as the loadmap is done, elm will pass the results into the 
   update function
   - which will put the received gmap in the model
   - and the new model is rendered.

It seems to me that the Tick time cycle could be skipped, if the init 
function would output the loadmap directly, but I may be missing something 
here.

In any case, if you want to render a google map on button click, the setup 
could be:

   - add a Msg called LoadButtonClicked or something, and add a button in 
   your view which triggers this (with onClick)
   - in your update function, add a handler for LoadButtonClicked that 
   returns a model + the load command.



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