reactive_signal/signal

Types

Signal is read-only, but chainable Channel.

pub opaque type Signal(s)

Functions

pub fn chain(sig: Signal(a), f: fn(a) -> Signal(b)) -> Signal(b)
pub fn from_channel(chn: Channel(a)) -> Signal(a)
pub fn map(sig: Signal(a), f: fn(a) -> b) -> Signal(b)
pub fn new(init: a) -> #(Signal(a), Channel(a))
pub fn pure(a: a) -> Signal(a)
pub fn subscribe(
  signal: Signal(a),
  new_subscriber: fn(a) -> Nil,
) -> Nil

Subscribe to a channel Subscriber is start as a new process, and exit when the next value is published, or parent process is exit.

pub fn subscribe_from_subject(
  signal: Signal(a),
  subscriber_subject: Subject(a),
) -> Nil

Subscribe to a channel by Subject. Subject will receive messages when the channel value is updated.

pub fn subscribe_with_wait_next(
  signal: Signal(a),
  new_subscriber: fn(a, fn() -> Nil) -> Nil,
) -> Nil

Subscribe to a channel with a wait_next function, that will wait for the next value to be published.

Search Document