Reactive Elixir v0.5.0 SingleDep View Source
SingleDep shows how to use Reactivity with a single dependency.
We initialize the system by creating two source signals. These signals take in:
- A function that takes one parameter (it’s previous value).
- An initial value.
- An rate of value generation (ms).
- A name.
We create temperature and seconds.
In the app() function we create a new signal “hot_cold” that will produce a pepper emoji or a snowflake emoji based on the temperature.
Then we apply a new function to that that prints out the current value.
Finally we create a