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::MSG>) -> DomNode
pub fn create_dom_node(&self, node: &Node<APP::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) -> Self
pub fn new(app: APP) -> Self
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>>) -> Self
pub fn from_rc_app(app: Rc<RefCell<APP>>) -> Self
create a program from Rc<RefCell
Sourcepub fn append_to_mount(app: APP, mount_node: &Node) -> ManuallyDrop<Self>
pub fn append_to_mount(app: APP, mount_node: &Node) -> ManuallyDrop<Self>
Sourcepub fn replace_mount(app: APP, mount_node: &Node) -> ManuallyDrop<Self>
pub fn replace_mount(app: APP, mount_node: &Node) -> ManuallyDrop<Self>
Sourcepub fn clear_append_to_mount(app: APP, mount_node: &Node) -> ManuallyDrop<Self>
pub fn clear_append_to_mount(app: APP, mount_node: &Node) -> ManuallyDrop<Self>
clear the existing children of the mount before mounting the app
Sourcepub fn clear_mount(app: APP, mount_node: &Node) -> ManuallyDrop<Self>
pub fn clear_mount(app: APP, mount_node: &Node) -> ManuallyDrop<Self>
clear the existing children of the mount before mounting the app
Sourcepub fn clear_mount_to_body(app: APP) -> ManuallyDrop<Self>
pub fn clear_mount_to_body(app: APP) -> ManuallyDrop<Self>
clear the existing children of the document body before mounting the app
Sourcepub fn mount_to_body(app: APP) -> ManuallyDrop<Self>
pub fn mount_to_body(app: APP) -> ManuallyDrop<Self>
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::MSG>)
pub fn dispatch_multiple(&mut self, msgs: impl IntoIterator<Item = APP::MSG>)
dispatch multiple MSG