Current section
Files
Jump to
Current section
Files
lib/signal/signal_generic.ex
defmodule Reactivity.Signal.Generic do
@moduledoc """
Some functions that work on both derived and source signals.
"""
require Logger
@doc """
Adds a child to the given signal.
"""
def add_child({:signal, _, parent}, {:signal, _, child}) do
GenServer.call(parent, {:add_child, child})
end
@doc """
Gets the last value generated on a node *synchronously*.
"""
def last_value({:signal, _, signal}) do
x = GenServer.call(signal, {:last_value})
Logger.debug "Last value received: #{inspect x}"
{:ok, value} = x
value
end
end