macro_rules! impl_onchange {
($name:ident, $patch_json:ty, $($element:ident),*) => { ... };
}Expand description
UI macro: implements a _onchange methods that perform a PATCH request.
Given a name and several elements, this macro implements
name_element_onchange methods with signature fn name_element_onchange(&self) -> Closure<dyn Fn() -> JsValue>, whose return
value can be used as the onchange closure for each of the elements. The
closure obtains the Rust value of the element using
InputElement::get, creates a PATCH
object of type $patch_json that contains element set to a Some
containing the obtained value and the remaining members set to None (their
Default::default value), passes the $patch_json object to a
user-defined name_onchange_patch_modify method that can modify the value
of this object, and finally calls and awaits patch_name_update_elements,
which performs the PATCH request and updates the UI elements using the
response.