pub trait CustomElement<MSG> {
    // Required methods
    fn custom_tag() -> &'static str;
    fn observed_attributes() -> Vec<&'static str>;
    fn attribute_changed<APP>(
        program: &Program<APP, MSG>,
        attr_name: &str,
        old_value: JsValue,
        new_value: JsValue
    )
       where APP: Application<MSG> + 'static,
             MSG: 'static;
    fn connected_callback(&mut self);
    fn disconnected_callback(&mut self);
    fn adopted_callback(&mut self);
}
Expand description

a trait for implementing CustomElement in the DOM with custom tag

Required Methods§

source

fn custom_tag() -> &'static str

the custom tag that this custom element will be registerd to the browser

source

fn observed_attributes() -> Vec<&'static str>

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<APP>( program: &Program<APP, MSG>, attr_name: &str, old_value: JsValue, new_value: JsValue )where APP: Application<MSG> + 'static, MSG: '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

source

fn connected_callback(&mut self)

the component is attached to the dom

source

fn disconnected_callback(&mut self)

the component is removed from the DOM

source

fn adopted_callback(&mut self)

the component is moved or attached to the dom

Implementors§