pub struct Program<APP>where
APP: Application,{
pub root_node: Rc<RefCell<Option<DomNode>>>,
/* private fields */
}
Expand description
Program handle the lifecycle of the APP
Fields§
§root_node: Rc<RefCell<Option<DomNode>>>
the first element of the app view, where the patch is generated is relative to
Implementations§
Source§impl<APP> Program<APP>where
APP: Application + 'static,
impl<APP> Program<APP>where
APP: Application + 'static,
Sourcepub fn create_dom_node(&self, node: &Node<<APP as Application>::MSG>) -> DomNode
pub fn create_dom_node(&self, node: &Node<<APP as Application>::MSG>) -> DomNode
Create a dom node
Source§impl<APP> Program<APP>where
APP: Application + 'static,
impl<APP> Program<APP>where
APP: Application + 'static,
Source§impl<APP> Program<APP>where
APP: Application,
impl<APP> Program<APP>where
APP: Application,
Source§impl<APP> Program<APP>where
APP: Application,
impl<APP> Program<APP>where
APP: Application,
Source§impl<APP> Program<APP>where
APP: Application,
impl<APP> Program<APP>where
APP: Application,
Sourcepub fn new(app: APP) -> Program<APP>
pub fn new(app: APP) -> Program<APP>
Create an Rc wrapped instance of program, initializing DomUpdater with the initial view and root node, but doesn’t mount it yet.
Sourcepub fn from_rc_app(app: Rc<RefCell<APP>>) -> Program<APP>
pub fn from_rc_app(app: Rc<RefCell<APP>>) -> Program<APP>
create a program from Rc<RefCell
Sourcepub fn append_to_mount(
app: APP,
mount_node: &Node,
) -> ManuallyDrop<Program<APP>>
pub fn append_to_mount( app: APP, mount_node: &Node, ) -> ManuallyDrop<Program<APP>>
Sourcepub fn replace_mount(app: APP, mount_node: &Node) -> ManuallyDrop<Program<APP>>
pub fn replace_mount(app: APP, mount_node: &Node) -> ManuallyDrop<Program<APP>>
Sourcepub fn clear_append_to_mount(
app: APP,
mount_node: &Node,
) -> ManuallyDrop<Program<APP>>
pub fn clear_append_to_mount( app: APP, mount_node: &Node, ) -> ManuallyDrop<Program<APP>>
clear the existing children of the mount before mounting the app
Sourcepub fn clear_mount(app: APP, mount_node: &Node) -> ManuallyDrop<Program<APP>>
pub fn clear_mount(app: APP, mount_node: &Node) -> ManuallyDrop<Program<APP>>
clear the existing children of the mount before mounting the app
Sourcepub fn clear_mount_to_body(app: APP) -> ManuallyDrop<Program<APP>>
pub fn clear_mount_to_body(app: APP) -> ManuallyDrop<Program<APP>>
clear the existing children of the document body before mounting the app
Sourcepub fn mount_to_body(app: APP) -> ManuallyDrop<Program<APP>>
pub fn mount_to_body(app: APP) -> ManuallyDrop<Program<APP>>
Sourcepub fn mount(&mut self, mount_node: &Node, mount_procedure: MountProcedure)
pub fn mount(&mut self, mount_node: &Node, mount_procedure: MountProcedure)
each element and it’s descendant in the vdom is created into an actual DOM node.
Sourcepub fn update_dom(&mut self) -> Result<(), JsValue>
pub fn update_dom(&mut self) -> Result<(), JsValue>
execute DOM changes in order to reflect the APP’s view into the browser representation
Sourcepub fn queue_dom_patches(
&mut self,
dom_patches: Vec<DomPatch>,
) -> Result<(), JsValue>
pub fn queue_dom_patches( &mut self, dom_patches: Vec<DomPatch>, ) -> Result<(), JsValue>
patch the DOM to reflect the App’s view
Note: This is in another function so as to allow tests to use this shared code
Sourcepub fn inject_style_to_mount(&mut self, style: &str)
pub fn inject_style_to_mount(&mut self, style: &str)
inject style element to the mount node
Sourcepub fn dispatch_multiple(
&mut self,
msgs: impl IntoIterator<Item = <APP as Application>::MSG>,
)
pub fn dispatch_multiple( &mut self, msgs: impl IntoIterator<Item = <APP as Application>::MSG>, )
dispatch multiple MSG
Sourcepub fn dispatch(&mut self, msg: <APP as Application>::MSG)
pub fn dispatch(&mut self, msg: <APP as Application>::MSG)
dispatch a single msg
Sourcepub fn create_dom_patch(
&self,
new_vdom: &Node<<APP as Application>::MSG>,
) -> Vec<DomPatch>
pub fn create_dom_patch( &self, new_vdom: &Node<<APP as Application>::MSG>, ) -> Vec<DomPatch>
patch the DOM to reflect the App’s view
Note: This is in another function so as to allow tests to use this shared code
Source§impl<APP> Program<APP>where
APP: Application,
impl<APP> Program<APP>where
APP: Application,
Sourcepub fn update_dom_with_vdom(
&mut self,
new_vdom: Node<<APP as Application>::MSG>,
) -> Result<usize, JsValue>
pub fn update_dom_with_vdom( &mut self, new_vdom: Node<<APP as Application>::MSG>, ) -> Result<usize, JsValue>
patch the DOM to reflect the App’s view
Note: This is in another function so as to allow tests to use this shared code