Add use_on_mount and fix some typos (#1497)

* Add `use_on_mount` and fix some typos

* Optimize away UseOnMount struct

* `use_on_mount`, `use_on_unmount` -> `use_on_create`, `use_on_destroy`

* Make `use_on_unmount` deprecated

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
This commit is contained in:
LeonardandEvan Almloff authored and GitHub committed 2023-10-04 08:23:21 -05:00
1 parent 9f7a0a9f63
commit 30a3283438
4 files changed
+58 -13

No files matched your search

+8 -3
View File
@@ -3,13 +3,18 @@ use std::{any::Any, cell::Cell, future::Future};
use crate::UseFutureDep;
/// A hook that provides a future that executes after the hooks have been applied
/// A hook that provides a future that executes after the hooks have been applied.
///
/// Whenever the hooks dependencies change, the future will be re-evaluated.
/// If a future is pending when the dependencies change, the previous future
/// will be allowed to continue
/// will be allowed to continue.
///
/// - dependencies: a tuple of references to values that are `PartialEq` + `Clone`
/// **Note:** If your dependency list is always empty, use [`use_on_create`](crate::use_on_create).
///
/// ## Arguments
///
/// - `dependencies`: a tuple of references to values that are `PartialEq` + `Clone`.
/// - `future`: a closure that takes the `dependencies` as arguments and returns a `'static` future.
///
/// ## Examples
///