Clean up a number of examples

This commit is contained in:
Jonathan Kelley committed 2024-01-15 13:06:05 -08:00
1 parent f2caa3a3ad
commit 6134a2ce24
30 files changed
+284 -413

No files matched your search

+14 -2
View File
@@ -7,8 +7,11 @@ use std::{
};
use dioxus_core::{
prelude::{current_scope_id, has_context, provide_context, schedule_update_any},
use_hook, ScopeId,
prelude::{
current_scope_id, has_context, provide_context, schedule_update_any, use_hook,
IntoAttributeValue,
},
ScopeId,
};
use generational_box::{GenerationalRef, GenerationalRefMut};
@@ -306,6 +309,15 @@ impl<T: 'static> Signal<T> {
}
}
impl<T> IntoAttributeValue for Signal<T>
where
T: Clone + IntoAttributeValue,
{
fn into_value(self) -> dioxus_core::AttributeValue {
self.with(|f| f.clone().into_value())
}
}
impl<T: Clone + 'static> Signal<T> {
/// Get the current value of the signal. This will subscribe the current scope to the signal.
/// If the signal has been dropped, this will panic.