[][src]Trait mogwai::component::Component

pub trait Component where
    Self: Any + Sized,
    Self::ModelMsg: Clone,
    Self::ViewMsg: Clone,
    Self::DomNode: JsCast + AsRef<Node> + Clone
{ type ModelMsg; type ViewMsg; type DomNode; fn update(
        &mut self,
        msg: &Self::ModelMsg,
        tx_view: &Transmitter<Self::ViewMsg>,
        sub: &Subscriber<Self::ModelMsg>
    );
fn view(
        &self,
        tx: Transmitter<Self::ModelMsg>,
        rx: Receiver<Self::ViewMsg>
    ) -> Gizmo<Self::DomNode>; fn into_component(self) -> GizmoComponent<Self> { ... } }

Defines a component with distinct input (model update) and output (view update) messages.

See the module level documentation for more details.

Associated Types

type ModelMsg

A model message comes out from the view through a tx_on function into your component's update function.

type ViewMsg

A view message comes out from your component's update function and changes the view by being used in an rx_* function.

type DomNode

The type of DOM node that represents the root of this component.

Loading content...

Required methods

fn update(
    &mut self,
    msg: &Self::ModelMsg,
    tx_view: &Transmitter<Self::ViewMsg>,
    sub: &Subscriber<Self::ModelMsg>
)

Update this component in response to any received model messages. This is essentially the component's fold function.

fn view(
    &self,
    tx: Transmitter<Self::ModelMsg>,
    rx: Receiver<Self::ViewMsg>
) -> Gizmo<Self::DomNode>

Produce this component's gizmo using inputs and outputs.

Loading content...

Provided methods

fn into_component(self) -> GizmoComponent<Self>

Helper function for constructing a GizmoComponent for a type that implements Component.

Loading content...

Implementations on Foreign Types

impl<T, D> Component for Box<BuilderFn<T, D>> where
    T: Any + Clone,
    D: JsCast + AsRef<Node> + Clone + 'static, 
[src]

type ModelMsg = T

type ViewMsg = T

type DomNode = D

Loading content...

Implementors

Loading content...