[][src]Struct seed::App

pub struct App<Ms, Mdl, ElC, GMs = ()> where
    Ms: 'static,
    Mdl: 'static,
    ElC: View<Ms>, 
{ pub cfg: Rc<AppCfg<Ms, Mdl, ElC, GMs>>, pub data: Rc<AppData<Ms, Mdl>>, }

Fields

cfg: Rc<AppCfg<Ms, Mdl, ElC, GMs>>

Stateless app configuration

data: Rc<AppData<Ms, Mdl>>

Mutable app state

Methods

impl<Ms, Mdl, ElC: View<Ms> + 'static, GMs: 'static> App<Ms, Mdl, ElC, GMs>[src]

We use a struct instead of series of functions, in order to avoid passing repetitive sequences of parameters.

pub fn build(
    init: impl FnOnce(Url, &mut OrdersContainer<Ms, Mdl, ElC, GMs>) -> Init<Mdl> + 'static,
    update: fn(_: Ms, _: &mut Mdl, _: &mut OrdersContainer<Ms, Mdl, ElC, GMs>),
    view: fn(_: &Mdl) -> ElC
) -> AppBuilder<Ms, Mdl, ElC, GMs>
[src]

pub fn setup_window_listeners(&self)[src]

pub fn run(self) -> Self[src]

Deprecated since 0.4.2:

Please use AppBuilder.build_and_start instead

App initialization: Collect its fundamental components, setup, and perform an initial render.

pub fn update(&self, message: Ms)[src]

This runs whenever the state is changed, ie the user-written update function is called. It updates the state, and any DOM elements affected by this change. todo this is where we need to compare against differences and only update nodes affected by the state change.

We re-create the whole virtual dom each time (Is there a way around this? Probably not without knowing what vars the model holds ahead of time), but only edit the rendered, web_sys dom for things that have been changed. We re-render the virtual DOM on every change, but (attempt to) only change the actual DOM, via web_sys, when we need. The model stored in inner is the old model; updated_model is a newly-calculated one.

pub fn sink(&self, g_msg: GMs)[src]

pub fn process_cmd_and_msg_queue(&self, queue: VecDeque<Effect<Ms, GMs>>)[src]

pub fn add_message_listener<F>(&self, listener: F) where
    F: Fn(&Ms) + 'static, 
[src]

Trait Implementations

impl<Ms, Mdl, ElC: View<Ms>, GMs> Clone for App<Ms, Mdl, ElC, GMs>[src]

impl<Ms: 'static, Mdl: 'static, ElC: View<Ms>, GMs> Debug for App<Ms, Mdl, ElC, GMs>[src]

Auto Trait Implementations

impl<Ms, Mdl, ElC, GMs = ()> !Send for App<Ms, Mdl, ElC, GMs>

impl<Ms, Mdl, ElC, GMs = ()> !Sync for App<Ms, Mdl, ElC, GMs>

impl<Ms, Mdl, ElC, GMs> Unpin for App<Ms, Mdl, ElC, GMs>

impl<Ms, Mdl, ElC, GMs = ()> !UnwindSafe for App<Ms, Mdl, ElC, GMs>

impl<Ms, Mdl, ElC, GMs = ()> !RefUnwindSafe for App<Ms, Mdl, ElC, GMs>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]