wip: update hooks

This commit is contained in:
Jonathan Kelley committed 2021-12-13 00:14:47 -05:00
1 parent 96b3d56e09
commit 597a0456f5
6 files changed
+30 -21

No files matched your search

+5 -5
View File
@@ -1,4 +1,4 @@
use dioxus_core::Context;
use dioxus_core::{AnyContext, Context, Scope};
use futures::Future;
use std::{
cell::{Cell, RefCell},
@@ -7,10 +7,10 @@ use std::{
};
pub fn use_coroutine<'a, F: Future<Output = ()> + 'static>(
cx: Context<'a>,
cx: &dyn AnyContext<'a>,
mut f: impl FnMut() -> F + 'a,
) -> CoroutineHandle {
//
) -> CoroutineHandle<'a> {
let cx = cx.get_scope();
cx.use_hook(
move |_| State {
running: Default::default(),
@@ -56,7 +56,7 @@ struct State {
}
pub struct CoroutineHandle<'a> {
cx: Context<'a>,
cx: &'a Scope,
inner: &'a State,
}
impl Clone for CoroutineHandle<'_> {