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
javascript elm ports


source to share


No one has answered this question yet

Check out similar questions:

2237
How do I pass command line arguments to a Node.js program?
1690
How does data binding work in AngularJS?
1567
Converting form data to JavaScript object with jQuery
1513
JavaScript checks if a variable exists (defined / initialized)
491
Sending command line arguments to npm script
7
Encapsulating nested component port communication in Elm?
2
Elm share subscription?
1
External Firebase communication with Elm via ports?
0
Refactoring update fuction in base Elm application
-2
Consecutive messages / commands with "pending" semantics



All Articles
Loading...
X
Show
Funny
Dev
Pics