seed
seed copied to clipboard
Commands and Orders
Hi,
Trying to get my head around some concepts. Can someone kindly shed some light on what commands and orders are ? Are they the same thing? If not, how they are different, conceptually ?
Who is being "order"ed here ? the run-time ? And who is the command for ? other components ? I'm confused.
Thanks,
orders is a parameter in your init and update function that allows you to "give orders" to Seed. So orders are basically just method calls that Seed/runtime should handle.
commands are basically async operations - fetch, timeout, etc. So orders.perform_cmd(..) just executes the Future (it creates a Promise under the hood).
There are no components in The Elm architecture - when you call orders.perform_cmd from your update function, the same update function is called once the command has been performed.
And yes, there are "TEA components", but each update and Msg of those "components" are just parts of the update/Msg tree (the tree that you've written by yourself).
There is no magic and special theory - every Msg has to go through your root update function.
Thanks a lot. That helps. I think I somehow got React's components mixed up with Elm.