fix use_hook imports

This commit is contained in:
Evan Almloff committed 2024-01-15 09:10:15 -06:00
1 parent 01726d6656
commit 20480c0a2d
4 files changed
+4 -17

No files matched your search

-12
View File
@@ -389,15 +389,3 @@ impl ScopeId {
with_scope(self, |cx| cx.height()).expect("to be in a dioxus runtime")
}
}
/// Spawn a future on a component given its [`ScopeId`].
pub fn spawn_at(fut: impl Future<Output = ()> + 'static, scope_id: ScopeId) -> Option<Task> {
with_runtime(|rt| rt.get_context(scope_id).unwrap().push_future(fut))
}
/// Spawn a future that Dioxus won't clean up when this component is unmounted
///
/// This is good for tasks that need to be run after the component has been dropped.
pub fn spawn_forever(fut: impl Future<Output = ()> + 'static) -> Option<Task> {
spawn_at(fut, ScopeId(0))
}