pub trait Component<MSG, XMSG> {
    fn update(&mut self, msg: MSG) -> Effects<MSG, XMSG>;
    fn view(&self) -> Node<MSG>;

    fn style(&self) -> String { ... }
    fn get_component_id(&self) -> Option<&String> { ... }
    fn observed_attributes() -> Vec<&'static str> { ... }
    fn attributes_changed(
        &mut self,
        _attributes_values: BTreeMap<String, String>
    ) { ... } fn attributes_for_mount(&self) -> BTreeMap<String, String> { ... } }
Expand description

A component has a view and can update itself.

The update function returns an effect which can contain follow ups and effects. Follow ups are executed on the next update loop of this component, while the effects are executed on the parent component that mounts it.

Required Methods

Update the model of this component and return follow up and/or effects that will be executed on the next update loop

the view of the component

Provided Methods

optionally a Component can specify its own css style

Component can have component id to identify themselves

returns the attributes that is observed by this component

This will be invoked when a component is used as a custom element and the attributes of the custom-element has been modified

This will be invoked when a component needs to set the attributes for the mounted element of this component

Implementors