Skip to content

Commit

Permalink
documentation touch up
Browse files Browse the repository at this point in the history
  • Loading branch information
Madoshakalaka committed Dec 22, 2021
1 parent 7ae2e96 commit 32d3870
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
28 changes: 24 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion yew-interop/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[package]
name = "yew-interop"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
license = "MIT"
description = "use javascript and css asynchrously in yew"
homepage = "https://github.com/Madoshakalaka/yew-interop"
repository = "https://github.com/Madoshakalaka/yew-interop"
readme = "../README.md"

keywords = ["yew", "interop", "js", "css", "npm"]
categories = ["api-bindings", "asynchronous", "wasm", "web-programming"]
Expand Down
7 changes: 5 additions & 2 deletions yew-interop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub use yew_interop_core::{Link, LinkType};
pub use yew_interop_macro::declare_resources;

/// Run javascript after a component is rendered.
/// Note the script will be re-run for every re-render.
/// Note the script will run for every render.
/// If you want to conditionally run the script, see [`use_conditional_script_effect`]
pub fn use_script_effect(src: &'static str) {
use_effect(move || {
Expand Down Expand Up @@ -36,7 +36,10 @@ fn insert_script(src: &str, document: &Document) {
}
}

/// The script will be re-run when `should_rerun` returns true.
/// Run a script conditionally.
///
/// `should_run` receives `d` as the argument and returns a `bool`.
/// The script will only run when `should_rerun` returns true.
pub fn use_conditional_script_effect<Dep, Filter>(src: &'static str, should_run: Filter, d: Dep)
where
Dep: PartialEq + 'static,
Expand Down

0 comments on commit 32d3870

Please sign in to comment.