Trait sauron::CustomElement
source · pub trait CustomElement<MSG> {
// Required methods
fn observed_attributes() -> Vec<&'static str, Global>;
fn attribute_changed<DSP>(
program: &DSP,
attr_name: &str,
old_value: JsValue,
new_value: JsValue
)
where DSP: Dispatch<MSG> + Clone + 'static;
// Provided method
fn attributes_for_mount(&self) -> BTreeMap<String, String, Global> { ... }
}
Expand description
a trait for implementing CustomElement in the DOM with custom tag
Required Methods§
sourcefn observed_attributes() -> Vec<&'static str, Global>
fn observed_attributes() -> Vec<&'static str, Global>
returns the attributes that is observed by this component These are the names of the attributes the component is interested in
sourcefn attribute_changed<DSP>(
program: &DSP,
attr_name: &str,
old_value: JsValue,
new_value: JsValue
)where
DSP: Dispatch<MSG> + Clone + 'static,
fn attribute_changed<DSP>( program: &DSP, attr_name: &str, old_value: JsValue, new_value: JsValue )where DSP: Dispatch<MSG> + Clone + 'static,
This will be invoked when a component is used as a custom element and the attributes of the custom-element has been modified
if the listed attributes in the observed attributes are modified