mirror of
https://github.com/leptos-rs/leptos
synced 2024-09-20 06:21:57 +00:00
added Signal::default
method
This commit is contained in:
parent
7631ce3b09
commit
c9ac4ed2b5
1 changed files with 9 additions and 0 deletions
|
@ -169,6 +169,15 @@ where
|
|||
SignalTypes::DerivedSignal(_, s) => s.with(|s| s()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a signal that yields the default value of `T` when
|
||||
/// you call `.get()` or `signal()`.
|
||||
pub fn default(cx: Scope) -> Self
|
||||
where
|
||||
T: Default,
|
||||
{
|
||||
Self::derive(cx, || Default::default())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<ReadSignal<T>> for Signal<T> {
|
||||
|
|
Loading…
Reference in a new issue