Trait sauron::StatefulComponent

source ·
pub trait StatefulComponent {
    // Required methods
    fn attribute_changed(&mut self, attr: DomAttr);
    fn child_container(&self) -> Option<DomNode>;

    // Provided methods
    fn remove_attribute(&mut self, _attr_name: &'static str) { ... }
    fn append_children(&mut self, _children: Vec<DomNode>) { ... }
    fn remove_child(&mut self, _index: usize) { ... }
    fn connected_callback(&mut self) { ... }
    fn disconnected_callback(&mut self) { ... }
    fn adopted_callback(&mut self) { ... }
}
Expand description

A component that can be used directly in the view without mapping

Required Methods§

source

fn attribute_changed(&mut self, attr: DomAttr)

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 child_container(&self) -> Option<DomNode>

return the DomNode which contains the children DomNode

Provided Methods§

source

fn remove_attribute(&mut self, _attr_name: &'static str)

remove the attribute with this name

source

fn append_children(&mut self, _children: Vec<DomNode>)

append a child into this component

source

fn remove_child(&mut self, _index: usize)

remove a child in this index

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§