Trait 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: 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§

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: AttributeName)

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§