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§

source

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

source

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

Provided Methods§

source

fn attributes_for_mount(&self) -> BTreeMap<String, String, Global>

This will be invoked when a component needs to set the attributes for the mounted element of this component

Implementors§