Skip to main content

bind

Function bind 

Source
pub fn bind<T>(key: &str, signal: Signal<T>)
where T: FromStr + ToString + Clone + 'static,
Expand description

Two-way-bind a signal to a stored preference: seed the signal from the store now (when a stored value exists and parses as T), then persist every later change. Call it right after creating the signal, before anything reads it. The write-back lives in the current reactive scope, so it stops with the page that created the signal.

let count = day_reactive::Signal::new(0i64);
day_part_prefs::bind("controls.count", count);
Day API ↩ Guides· daybrite.dev