- compile the SendToPort.elm to elm.js
elm-make SendToPort.elm --output elm.js
- open SendToPort.html
The view contains two buttons that send the information to the port in two ways:
-
by triggering an action that will send the information to JS incapsulated into an Effect.
-
by directly sending to the mailbox connected to the port.
The port code includes a way to filter the information sent to the mailbox.
The idea behind structuring code like this is that one could chose a strategy to traverse the port and not have to modify the code that sends the information.