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
impl<APP> Program<APP>where
APP: Application,
A node along with all of the closures that were created for that node’s events and all of it’s child node’s events.
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
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