sigmal/signal
See the readme for an example and some usage notes.
Types
Values
pub fn receive(signal signal: Signal(a)) -> promise.Promise(a)
Receives a message from the default (empty string, ""
) topic of the signal.
This will not receive messages from any of the other topics, i.e. is
not a catch-all.
pub fn receive_from_topic(
signal signal: Signal(a),
topic topic: String,
) -> promise.Promise(a)
Receives a message from the specified topic.
Do not use the empty string (""
) topic as that is reserved for the send
and receive
functions.
pub fn receive_from_topics(
signal signal: Signal(a),
topics topics: List(String),
) -> promise.Promise(a)
Receive a message to the specified topics. Only the first message to any of the topics is returned, and the rest ignored.
Do not use the empty string (""
) topic as that is reserved for the send
and receive
functions.
pub fn send(signal signal: Signal(a), message message: a) -> Nil
Sends a message to the default (empty string, ""
) topic of the signal.
This will not send a message to any of the other topics, i.e. is
not a catch-all.
pub fn send_to_topic(
signal signal: Signal(a),
topic topic: String,
message message: a,
) -> Nil
Sends a message to the specified topic.
Do not use the empty string (""
) topic as that is reserved for the send
and receive
functions.
pub fn send_to_topics(
signal signal: Signal(a),
topics topics: List(String),
message message: a,
) -> Nil
Sends a message to the specified topics. The message are sent in the order of the topics provided.
Do not use the empty string (""
) topic as that is reserved for the send
and receive
functions.