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§
sourcefn attribute_changed(&mut self, attr: DomAttr)
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
sourcefn child_container(&self) -> Option<DomNode>
fn child_container(&self) -> Option<DomNode>
return the DomNode which contains the children DomNode
Provided Methods§
sourcefn remove_attribute(&mut self, _attr_name: &'static str)
fn remove_attribute(&mut self, _attr_name: &'static str)
remove the attribute with this name
sourcefn append_children(&mut self, _children: Vec<DomNode>)
fn append_children(&mut self, _children: Vec<DomNode>)
append a child into this component
sourcefn remove_child(&mut self, _index: usize)
fn remove_child(&mut self, _index: usize)
remove a child in this index
sourcefn connected_callback(&mut self)
fn connected_callback(&mut self)
the component is attached to the dom
sourcefn disconnected_callback(&mut self)
fn disconnected_callback(&mut self)
the component is removed from the DOM
sourcefn adopted_callback(&mut self)
fn adopted_callback(&mut self)
the component is moved or attached to the dom