Fix non tokio builds for desktop
This commit is contained in:
15 files changed
+274
-437
No files matched your search
@@ -67,12 +67,6 @@ pub use use_coroutine::*;
|
||||
mod use_future;
|
||||
pub use use_future::*;
|
||||
|
||||
// mod use_effect;
|
||||
// pub use use_effect::*;
|
||||
|
||||
// mod use_memo;
|
||||
// pub use use_memo::*;
|
||||
|
||||
// mod use_on_create;
|
||||
// pub use use_on_create::*;
|
||||
|
||||
|
||||
@@ -100,3 +100,13 @@ pub fn use_on_destroy<D: FnOnce() + 'static>(destroy: D) {
|
||||
pub fn use_on_drop<D: FnOnce() + 'static>(ondrop: D) {
|
||||
use_on_destroy(ondrop);
|
||||
}
|
||||
|
||||
pub fn use_hook_with_cleanup<T: Clone + 'static>(
|
||||
hook: impl FnOnce() -> T,
|
||||
cleanup: impl FnOnce(T) + 'static,
|
||||
) -> T {
|
||||
let value = use_hook(|| hook());
|
||||
let _value = value.clone();
|
||||
use_on_destroy(move || cleanup(_value));
|
||||
value
|
||||
}
|
||||
Reference in new issue
Block a user