Javascript to Elm

18: Ports by example

Informações:

Sinopsis

More Ports Ports, the Actor Model. Ports is not server/http, but rather the Actor Model Talking with messages. Messages In, Messages Out. Erlang/Elixir, webworkers, Scala Let’s just have 1 port. Singular. Let’s NOT wrap the JS API. Murphy’s “Outside Info” of a single pair of ports The Actor Model The actor model is a conceptual model to deal with concurrent computation. The actor is just a thing that receives a message and then does something based on that message. The actor can have private state, that cannot be changed directly by another actor. Actors work in a system of actors. If you only have a single actor, then there’s no one to send messages to or worse, no one to get messages to. In our case, Elm is an actor, and JS is an actor, sending messages back and forth to each other. Messages sent to an actor or processed sequentially. Needs 3 things of computation: getting something done store things be able to communicate Actors can only do one of the following: Create more actors; Send messages to o