You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As discussed on Discord, sometimes it's needed to add/remove a class with a dynamic name
@Pauan suggested a fn dynamic_class_signal<S>(self, signal: S) -> Self where S: Signal<Item = Option<String>>
which makes something like this much more ergonomic:
.with_node!(element => {
.future({
let mut old = None;
signal.for_each(move |value| {
if let Some(old) = old.as_deref() {
element.class_list().remove_1(old).unwrap();
}
let name = ...;
element.class_list().add_1(name).unwrap();
old = Some(name);
ready(())
})
})
})
The text was updated successfully, but these errors were encountered:
As discussed on Discord, sometimes it's needed to add/remove a class with a dynamic name
@Pauan suggested a
fn dynamic_class_signal<S>(self, signal: S) -> Self where S: Signal<Item = Option<String>>
which makes something like this much more ergonomic:
The text was updated successfully, but these errors were encountered: