macro_rules! impl_section_custom {
($name:ident, $json:ty, $patch_json:ty, $url:expr, $($element:ident),*) => { ... };
}Expand description
UI macro: implements a REST API section using custom functionality.
This UI macro is used to implement the interaction between the UI and a
section of the REST API using some custom functions. See impl_section
for the equivalent without custom functions.
This macro includes the following:
-
impl_patchcall to implement a method that sends a PATCH request. -
impl_update_elementscall to implement methods to update the UI elements. -
impl_onchangecall to implementonchangemethods for each element that perform a PATCH request and update all the UI elements of this section using the result. -
Implements a
patch_name_update_elementsof signatureasync fn patch_name_update_elements(&self, json: &$patch_json) -> Result<(), JsValue>that updates theapi_statemember of the UI with thejsondata, calls theupdate_name_all_elementsmethod to update the contents of UI elements to match the server-side state, and calls the user-definedpost_patch_name_update_elementswith thejsonto perform any required user-defined functionality.
See impl_section for an example.