To give you an example of correct usage, this is how I am initializing my
Elm program in JavaScript:

    var flags =
        { seed: [ Math.floor(Math.random()*0xFFFFFFFF),
Math.floor(Math.random()*0xFFFFFFFF) ]
        , isMobile : mobileCheck()
        };

    var app = Elm.Main.embed(document.getElementById("app"), flags);

And then the relevant code in Main.elm:

type alias Flags =
    { seed : (Int, Int), isMobile : Bool }

main : Program Flags
main = App.programWithFlags { ... }


On Wed, Jun 8, 2016 at 1:41 PM, Nick H <[email protected]> wrote:

> That function signature you are quoting is for an Elm function called
> Html.embed. It completely unrelated to the JavaScript "embed" function that
> we are discussing here. The documentation relevant to what you are trying
> to do is located here <http://guide.elm-lang.org/interop/html.html>.
>
> The correct usage should be Elm.Main.embed(node, flags).  At least, it
> seems to be working in my own code. Could you provide us with a sample of
> your code where you are calling Elm.main.embed, and what error message are
> you getting when you try to use it?
>
> On Wed, Jun 8, 2016 at 1:12 PM, Jaroslaw Zabiello <[email protected]>
> wrote:
>
>> Really? How to pass flags to Elm.Main.embed? None of those work:
>> Elm.Main.embed(node, flags), Elm.Main.embed(flags,
>> node), Elm.Main.embed([node], [flags]).
>>
>> The definition "embed : List (Attribute msg) -> List (Html msg) -> Html
>> msg" is too unclear for me. There should be some examples added to API defs.
>>
>>
>> On Wednesday, June 8, 2016 at 3:31:13 AM UTC+1, Frederick Yankowski wrote:
>>>
>>> `Html.App.programWithFlags` works fine with `embed()`, not just
>>> `fullscreen()`.
>>>
>>> --
>> 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.
>>
>
>

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