4 ms·
Great question! You're correct, it's the Browser module. In Elm, the entire application state is a single immutable value, which Browser owns and only changes
by rtfeldman 8y ago
Great question! You're correct, it's the Browser module.
In Elm, the entire application state is a single immutable value, which Browser owns and only changes when it calls `update` and a new value gets returned.
Browser calls `update` in response to these 3 situations:
1. An event handler from view (e.g. `onClick Foo` means Browser will call `update`, passing `Foo` as the message, whenever that element gets clicked)
2. A subscription fires (this is kinda like #1 except for global events instead of per-element handlers)
3. A command completes, and its resulting message needs to get sent to `update`
Every interaction in Elm is modeled in terms of one of these!