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: AttributeName) { ... }
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: AttributeName)
fn remove_attribute(&mut self, _attr_name: AttributeName)
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