Trait respo::RespoApp

source ·
pub trait RespoApp {
    type Model: RespoStore + Debug + Clone + PartialEq + 'static;
    type Action: Debug + Clone + RespoAction + 'static;

    fn dispatch(
        store: &mut RefMut<'_, Self::Model>,
        action: Self::Action
    ) -> Result<(), String>; fn get_mount_target(&self) -> &Node; fn get_store(&self) -> Rc<RefCell<Self::Model>>; fn get_memo_caches(&self) -> MemoCache<RespoNode<Self::Action>>; fn view(
        store: Ref<'_, Self::Model>,
        memo_caches: MemoCache<RespoNode<Self::Action>>
    ) -> Result<RespoNode<Self::Action>, String>; fn get_loop_delay() -> Option<i32> { ... } fn render_loop(&self) -> Result<(), String> { ... } }
Expand description

A template for a Respo app

Required Associated Types§

a type of the store, with a place for states tree

actions should include one for updating states tree

Required Methods§

simulating pure function updates to the model, but actually it’s mutations

bridge to mount target

bridge to store

bridge to memo caches

DSL for building a view

Provided Methods§

default interval in milliseconds, by default 100ms, pass None to use raq directly, pass Some(200) to redice cost

start a requestAnimationFrame loop for rendering updated store

Implementors§