removed use_raf_fn Clone from callback

This commit is contained in:
Maccesch 2023-08-04 13:19:34 +01:00
parent 04c880a3fc
commit 19c4f00c5b
2 changed files with 6 additions and 2 deletions

View file

@ -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. - 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`). 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 ## [0.6.2] - 2023-08-03
### Fixes 🍕 ### Fixes 🍕

View file

@ -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 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. /// you have to call `resume()` before the `callback` is executed.
pub fn use_raf_fn( pub fn use_raf_fn(
callback: impl Fn(UseRafFnCallbackArgs) + Clone + 'static, callback: impl Fn(UseRafFnCallbackArgs) + 'static,
) -> Pausable<impl Fn() + Clone, impl Fn() + Clone> { ) -> Pausable<impl Fn() + Clone, impl Fn() + Clone> {
use_raf_fn_with_options(callback, UseRafFnOptions::default()) 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. /// Version of [`use_raf_fn`] that takes a `UseRafFnOptions`. See [`use_raf_fn`] for how to use.
pub fn use_raf_fn_with_options( pub fn use_raf_fn_with_options(
callback: impl Fn(UseRafFnCallbackArgs) + Clone + 'static, callback: impl Fn(UseRafFnCallbackArgs) + 'static,
options: UseRafFnOptions, options: UseRafFnOptions,
) -> Pausable<impl Fn() + Clone, impl Fn() + Clone> { ) -> Pausable<impl Fn() + Clone, impl Fn() + Clone> {
let UseRafFnOptions { immediate } = options; let UseRafFnOptions { immediate } = options;