From dd5cdfdcfafc2d293c70660eff932f17bff170d0 Mon Sep 17 00:00:00 2001 From: Maccesch Date: Thu, 15 Jun 2023 20:30:05 +0100 Subject: [PATCH] release 0.3.1 --- CHANGELOG.md | 2 +- Cargo.toml | 2 +- README.md | 2 +- docs/book/src/introduction.md | 2 +- examples/use_interval/src/main.rs | 12 ++---------- src/use_interval.rs | 12 ++++-------- src/utils/pausable.rs | 3 +-- 7 files changed, 11 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10cbac40..54320a03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.3.1] - 2023-06-15 ### New Functions 🚀 diff --git a/Cargo.toml b/Cargo.toml index 2a8449db..fc192cba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leptos-use" -version = "0.3.0" +version = "0.3.1" edition = "2021" authors = ["Marc-Stefan Cassola"] categories = ["gui", "web-programming"] diff --git a/README.md b/README.md index b2badad3..4d92886b 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

Crates.io Docs & Demos - 31 Functions + 33 Functions


diff --git a/docs/book/src/introduction.md b/docs/book/src/introduction.md index e9edaf19..f97fb489 100644 --- a/docs/book/src/introduction.md +++ b/docs/book/src/introduction.md @@ -11,6 +11,6 @@

Crates.io Docs & Demos - 31 Functions + 33 Functions

\ No newline at end of file diff --git a/examples/use_interval/src/main.rs b/examples/use_interval/src/main.rs index cceb3688..d37aaf56 100644 --- a/examples/use_interval/src/main.rs +++ b/examples/use_interval/src/main.rs @@ -4,19 +4,11 @@ use leptos_use::{use_interval, UseIntervalReturn}; #[component] fn Demo(cx: Scope) -> impl IntoView { - let UseIntervalReturn { - counter, - reset, - is_active, - pause, - resume - } = use_interval(cx, 200); - - let (counter_read, _) = create_signal(cx, move || counter()); + let UseIntervalReturn { counter, .. } = use_interval(cx, 200); view! { cx,
-

"Interval fired: " { counter_read() }

+

"Interval fired: " { counter }

} } diff --git a/src/use_interval.rs b/src/use_interval.rs index 43e17263..a6db9966 100644 --- a/src/use_interval.rs +++ b/src/use_interval.rs @@ -1,12 +1,8 @@ -use crate::utils::{CloneableFn, CloneableFnWithArg, Pausable}; -use crate::{use_interval_fn, use_interval_fn_with_options, watch, UseIntervalFnOptions}; +use crate::utils::{CloneableFnWithArg, Pausable}; +use crate::{use_interval_fn_with_options, UseIntervalFnOptions}; use default_struct_builder::DefaultBuilder; -use leptos::leptos_dom::helpers::IntervalHandle; + use leptos::*; -use std::cell::Cell; -use std::marker::PhantomData; -use std::rc::Rc; -use std::time::Duration; /// Reactive counter increases on every interval. /// @@ -103,7 +99,7 @@ pub struct UseIntervalOptions { impl Default for UseIntervalOptions { fn default() -> Self { Self { - immediate: false, + immediate: true, callback: Box::new(|_: u64| {}), } } diff --git a/src/utils/pausable.rs b/src/utils/pausable.rs index 3a1dc349..36e0dda8 100644 --- a/src/utils/pausable.rs +++ b/src/utils/pausable.rs @@ -1,5 +1,4 @@ -use std::cell::Cell; -use leptos::{ReadSignal, Signal}; +use leptos::Signal; /// Pausable effect pub struct Pausable