Evan Almloff 2 年 前
コミット
a6e87cf340

+ 1 - 0
packages/hooks/Cargo.toml

@@ -21,3 +21,4 @@ log = { workspace = true }
 futures-util = { workspace = true, default-features = false }
 dioxus-core = { workspace = true }
 dioxus = { workspace = true }
+web-sys = { version = "0.3.64", features = ["Document", "Window", "Element"] }

+ 1 - 1
packages/hooks/src/lib.rs

@@ -22,7 +22,7 @@ macro_rules! to_owned {
 }
 
 mod use_on_unmount;
-pub use use_on_unmount;
+pub use use_on_unmount::*;
 
 mod usecontext;
 pub use usecontext::*;

+ 1 - 5
packages/hooks/src/use_on_unmount.rs

@@ -4,10 +4,6 @@
 /// ```rust
 /// use dioxus::prelude::*;
 
-/// fn main() {
-///     dioxus_web::launch(app)
-/// }
-
 /// fn app(cx: Scope) -> Element {
 ///     let state = use_state(cx, || true);
 ///     render! {
@@ -60,7 +56,7 @@
 ///     }
 /// }
 /// ```
-pub fn use_on_unmount<C: FnOnce() + 'static, D: FnOnce() + 'static>(cx: &ScopeState, destroy: D) {
+pub fn use_on_unmount<D: FnOnce() + 'static>(cx: &dioxus_core::ScopeState, destroy: D) {
     cx.use_hook(|| LifeCycle {
         ondestroy: Some(destroy),
     });