Reaxive.Elm
This module contains reactive implementations that follow the interface design of the ELM language.
Currently, it does not work properly as the termination of computations is not handled correctly.
Summary
as_stream(signal, timeout \\ :infinity) | Converts a signal in to regular lazy Elixir stream |
as_text(s) | Renders a signal as text |
every(millis) | Function |
filter(signal, pred) | |
from_stream(s) | |
lift(signal, fun) | Function |
log(msg) | |
make_signal(value \\ nil) | Creates a new signal instance with optional |
push(fun) | Functional pushing of signals without any state interaction |
signal_handler(subscriptions \\ [], fun, signal, state \\ nil) | Implements the internal receive loop for a signal |
stop(signal) | |
stream_handler(signal) | |
test() | |
test2() | |
test3() | |
with_index(signal) | Creates a Signal where each item from the signal will be wrapped in a tuple alongside its index |
Types ↑
signal :: Signal.t(any)
signal(a) :: Signal.t(a)
sig_func :: (any, any -> {:reply, any, any} | {:noreply, any})
Functions
Specs:
- as_stream(signal, pos_integer | :infinity) :: Enumerable.t
Converts a signal in to regular lazy Elixir stream.
Specs:
- every(integer) :: signal(integer)
Function every
is an input signal, i.e. it generates new signal values
in an asynchronous manner. As an input signal is does not rely an any other
signals, it is a root in dependency graph of signals.
Specs:
Specs:
Function lift
creates a new signal of type b
by applying
function fun
to each value of signal
, which has type a
.
Consequently, function fun
maps from type a
to b
.
Specs:
- signal_handler([{signal(any), reference}], sig_func, signal(any), any) :: no_return
Implements the internal receive loop for a signal.
Its task is to manage the subscriptions of signals to which values are propagated.
Subscriptions are managed with register
, unregister
and DOWN
messages. The
latter are created by monitoring signals and ensures that died signals are automatically
unsubscribed, helping in both situations when nasty things happen and when signals do
not know how to unsubscribe.