On Wednesday, November 23, 2016 at 9:35:21 PM UTC, Noah Hall wrote: > > You'll need to set up a port to pull the generated string out, but > it's trivial bit of work to do with the elm-server-side-renderer > project. Just take a look at how something like elm-test pulls values > out through a port. >
I should have read this more closely, because I spent ages looking at elm-test and wondering how it runs the test Program, and gets results out. In particular it uses testModule.worker to pass the start flags into the program, but I was finding that myModule.worker was undefined. Well of course it is, I was using Html.programWithFlags, when I should have been using Platform.programWithFlags. Platform.programWithFlags is headerless, so there is no view. Then I look in an elm-test example, and I see that it is indeed using a port to return the results. I suppose another approach might be to use a Program type that does have a view, set up the javascript environment in such a way that it polyfills enough of the browser environment that the 'normalRenderer' will be able to work. Then render the HTML to the view and extract it from there? It might make server side rendering more naturally fit into Elm to define a particular Program type for it, that has a view. Will go with the port 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.
