pream/signal
Types
Values
pub fn computed(with fun: fn() -> a) -> Signal(a)
https://npmx.dev/package-docs/@preact%2Fsignals/v/2.9.1#function-computed
pub fn effect(run: fn() -> a) -> a
https://npmx.dev/package-docs/@preact%2Fsignals/v/2.9.1#function-effect
pub fn map(
signal: Signal(a),
map compute: fn(a) -> b,
) -> Signal(b)
similar to computed but wraps a single signal inside a computed. useful for transformations
pub fn new(state a: a) -> Signal(a)
https://npmx.dev/package-docs/@preact%2Fsignals/v/2.9.1#function-signal
pub fn new_persisted(
with name: String,
and initial_value: a,
) -> Signal(a)
same as new but stores inside localStorage
pub fn peek(signal: Signal(a)) -> a
reads value of the signal without subscribing
this can be used inside computed/effect to opt-out
of reactivity