From 19c4f00c5bcce12077263335eb4d3207185d0dfe Mon Sep 17 00:00:00 2001 From: Maccesch Date: Fri, 4 Aug 2023 13:19:34 +0100 Subject: [PATCH] removed use_raf_fn Clone from callback --- CHANGELOG.md | 4 ++++ src/use_raf_fn.rs | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 318a621..f06f064 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The option `manual` has been renamed to `immediate` to make it more consistent with other functions. To port please note that `immediate` is the inverse of `manual` (`immediate` = `!manual`). +### Other Changes 🔥 + +- Callback in `use_raf_fn` doesn't require to be cloneable anymore + ## [0.6.2] - 2023-08-03 ### Fixes 🍕 diff --git a/src/use_raf_fn.rs b/src/use_raf_fn.rs index 237cf00..b5c6755 100644 --- a/src/use_raf_fn.rs +++ b/src/use_raf_fn.rs @@ -35,14 +35,14 @@ use wasm_bindgen::JsCast; /// You can use `use_raf_fn_with_options` and set `immediate` to `false`. In that case /// you have to call `resume()` before the `callback` is executed. pub fn use_raf_fn( - callback: impl Fn(UseRafFnCallbackArgs) + Clone + 'static, + callback: impl Fn(UseRafFnCallbackArgs) + 'static, ) -> Pausable { use_raf_fn_with_options(callback, UseRafFnOptions::default()) } /// Version of [`use_raf_fn`] that takes a `UseRafFnOptions`. See [`use_raf_fn`] for how to use. pub fn use_raf_fn_with_options( - callback: impl Fn(UseRafFnCallbackArgs) + Clone + 'static, + callback: impl Fn(UseRafFnCallbackArgs) + 'static, options: UseRafFnOptions, ) -> Pausable { let UseRafFnOptions { immediate } = options;