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(())
})
})
})
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: