Remove a number of hooks

This commit is contained in:
Jonathan Kelley committed 2024-01-15 14:51:34 -08:00
1 parent fe12b1062f
commit b291a5c0b0
10 files changed
+4 -1194

No files matched your search

-48
View File
@@ -1,48 +0,0 @@
use dioxus_core::ScopeState;
use std::future::Future;
#[macro_export]
macro_rules! use_callback {
// ($cx:ident, || || $($rest:tt)*) => { use_callback( $cx, (), |_| $($rest)* ) };
// ($cx:ident, || || $($rest:tt)*) => { use_callback( $cx, (), |_| $($rest)* ) };
($cx:ident, || $($rest:tt)*) => {
use_callback(
$cx,
move || $($rest)*
)
};
($cx:ident, |$($args:tt),* | $($rest:tt)*) => {
use_callback(
$cx,
move || $($rest)*
)
};
($cx:ident, $($rest:tt)*) => {
use_callback(
$cx,
move || $($rest)*
)
};
}
pub fn use_callback<T, R, F>(, make: impl FnOnce() -> R) -> impl FnMut(T) + '_
where
R: FnMut(T) -> F + 'static,
F: Future<Output = ()> + 'static,
{
let mut hook = make();
move |evt| cx.spawn(hook(evt))
}
fn _it_works() {
let _p = use_callback(|| {
|()| async {
//
}
});
// let p = use_callback!(|| |evt| async {
// //
// });
}