Sending data to port in Elm as initial command

I have an outgoing port which is defined like this:

port errors : List String -> Cmd msg

      

Then I define my program like this:

init : Flags -> (Model, Cmd Msg)
init flags =
  ( initialModel flags, errors [ "an error" ] )

main : Program Flags Model Msg
main =
  Html.programWithFlags
    { init = init
    , view = view
    , update = update
    , subscriptions = subscriptions
    }

      

It compiles and runs, but on the javascript side, I don't see this first message . Of course, if I interact further with the application, I can see that a certain port is sending data, so I am sure it is working correctly.

+3


source to share





All Articles