On Monday, January 9, 2017 at 11:49:50 AM UTC, Peter Damoc wrote: > > Thank for the reply, Rupert. > > My challenge is different. I want to be able to generate the needed code > using Native. > In other words, the code that mounts the component does not know the name > of the module. > It receives the implementation just like VirtualDom.program receives the > implementation of a regular Elm program. > > I managed to figure out how to start an independent component and now I > moved to trying to figure out how to communicate with this component. >
I don't think I have quite grokked what you are trying to do. Have you considered making a custom Platform.Program implementation specifically for web components, as I suggested previously? Here is the one I wrote for server side programs: https://github.com/rupertlssmith/elm-server-side-renderer/blob/master/src/Native/ServerSidePrograms.js As you can see, the name of the module gets passed in as an argument. You could construct your web component there, and there are various ways you can obtain a reference to the Elm module that is implementing the program. For example, here: https://github.com/rupertlssmith/elm-java/blob/master/elm-render/src/main/resources/bootnashorn.js I get it through the global Elm var with Elm[moduleName]. -- 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.
