Thanks Christian. That does work. Now I'm attempting to translate this into an application using react-elm-components.
I am already using Html.programWithFlags for passing in flags, and I can pass in ports using this method as well. I am now faced with the same problem where it is unclear when all of the DOM nodes are available Elm creates. I have tried using setInterval along with ReactDOMNode.findDOMNode to query for certain DOM nodes with no luck. On Monday, April 3, 2017 at 6:47:10 PM UTC-6, Christian Charukiewicz wrote: > > I think what you want to do here is load your compiled Elm js script > followed by your googleapis script. > > One way to do this would be to use jQuery's getScript() function (or a > vanilla JS equivalent of it <http://stackoverflow.com/a/28002292>) to > sequence the order of the loading. > > With jQuery your approach would look something like this (note I have not > tested this code): > > <!-- import jquery here --> > <!-- load your elm app here --> > > function initElmApp(callback) { > var node = document.getElementById('elm'); > var app = Elm.Main.embed(node); > callback(); > } > > function initGoogleScript() { > $.getScript('path/to/google-places'); > } > > initElmApp(initGoogleScript()); > > > Someone else may have a better way to do this, but this should work. > > > On Monday, April 3, 2017 at 7:11:09 PM UTC-5, Fikse wrote: >> >> Is there a way to tell if Elm is mounted in the DOM? I am attempting to >> use Google Places with ports. The Google Places code is trying to attach to >> an HTML element generated by Elm, but it doesn't exist on the page. My code >> is at https://ellie-app.com/Pzg2NLX7W5a1/3 and the error can be found in >> the developer tools console. >> >> >> - fikse >> >> -- 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.
