Skip to content

Commit

Permalink
added missing cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
photovoltex committed Mar 17, 2024
1 parent 47f3a12 commit 6b37d5a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/event/listen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,14 @@ impl ListenHandle {
// creating this signal in a leptos component holds the value in scope, and drops it automatically
let handle = leptos::create_rw_signal(None);
leptos::spawn_local(async move {
if cfg!(feature = "initial_value") && acquire_initial_value {
#[cfg(any(all(target_family = "wasm", feature = "initial_value")))]
if acquire_initial_value {
match F::get_value().await {
Ok(value) => set_signal.set(value),
Err(why) => log::error!("{why}"),
}
}


let listen_handle = ListenHandle::register(F::EVENT_NAME, move |value: F::Type| {
log::trace!("update for {}", F::EVENT_NAME);
Expand Down

0 comments on commit 6b37d5a

Please sign in to comment.