I understand ports are supposed to be the preferred way that elm interacts with javascript.
While it initially seems kinda backward:
* A port without an implementation can be used by javascript to execute elm code.
* A port with an implementation is used to execute of javascript code.
This makes sense since its signals rather than code that is exported, thus:
* A port without an implementation defines a signal that can be used by javascript to trigger execution of elm code.
* A port with an implementation is used to export a signal that can trigger the execution of any javascript code which subscribes to this signal.
A few things I find a bit unclear:
* Why is main not a port?
* Why do we need to define a separate port to execute tasks (instead of returning these through main)?
* Would this imply that my model update logic runs multiple times? once to export the view and once again to export the tasks?
* Would any impure side-effects such as Debug.log in model updates be executed multiple times?
* How does elm determine that the port is used for tasks rather than javascript interop, function signature?