On Thursday, August 4, 2016 at 11:30:00 PM UTC+1, Rupert Smith wrote: > > The next step I think will be to take the navigation bar, and the clock > widget and organize the code in such a way that the widget is a re-usable > component that I can embed in the navigation bar. >
Up till now I have mostly messed around with the view - so I can use a functional language to render a view. This is very nice and a lot more powerful than say Handlebars templates. I started using StringTemplate in Java because it claimed to be a functional language that did templating. In fact, it never really lived up to its claim to be a functional language. Elm views do feel like a functional templating language - it is easy to combine the functions that produce output with whatever complex functions you need to structure or calculate the content of the output. I have followed this guide to structuring the code: http://blog.jenkster.com/2016/04/how-i-structure-elm-apps.html#comment-2634825704 Moderately helpful - at least it made the files smaller, I know which file to open to adjust the model, update function or view and there is not too much text in each. It feels more manageable that way. But this is definitely getting harder... I have embedded the clock as a component within another, which is the main body part of the page. What I am struggling a bit with, is how do I attach the 'subscription' that transforms Time into a Tick that then drives the clock 'update' function back to the top-level subscription needed to build the whole application? I need a Tick Msg at the top-level to do this? This feels a bit strange, surely there is some way I can attach the clock to the timer without needing to be aware of that from outside of that particular component? That is, just add the clock to my view and let it tick away all by itself... -- 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.
