Fix cargo test and a number of little cleanup bugs

This commit is contained in:
Jonathan Kelley committed 2024-01-30 17:33:14 -08:00
1 parent eff1dd6c90
commit 0bd9692e45
49 files changed
+307 -309

No files matched your search

+9
View File
@@ -216,10 +216,18 @@ pub fn use_drop<D: FnOnce() + 'static>(destroy: D) {
});
}
/// A hook that allows you to insert a "before render" function.
///
/// This function will always be called before dioxus tries to render your component. This should be used for safely handling
/// early returns
pub fn use_before_render(f: impl FnMut() + 'static) {
use_hook(|| before_render(f));
}
/// Push this function to be run after the next render
///
/// This function will always be called before dioxus tries to render your component. This should be used for safely handling
/// early returns
pub fn use_after_render(f: impl FnMut() + 'static) {
use_hook(|| after_render(f));
}
@@ -274,6 +282,7 @@ pub async fn flush_sync() {
}
}
/// Use a hook with a cleanup function
pub fn use_hook_with_cleanup<T: Clone + 'static>(
hook: impl FnOnce() -> T,
cleanup: impl FnOnce(T) + 'static,
+2
View File
@@ -45,10 +45,12 @@ impl Task {
Runtime::with(|rt| !rt.tasks.borrow()[self.0].active.get()).unwrap_or_default()
}
/// Wake the task.
pub fn wake(&self) {
Runtime::with(|rt| _ = rt.sender.unbounded_send(SchedulerMsg::TaskNotified(*self)));
}
/// Set the task as active or paused.
pub fn set_active(&self, active: bool) {
Runtime::with(|rt| rt.tasks.borrow()[self.0].active.set(active));
}