pub struct PercyDom {
pub events: VirtualEvents,
/* private fields */
}
Expand description
Used for keeping a real DOM node up to date based on the current VirtualNode and a new incoming VirtualNode that represents our latest DOM state.
Also powers event delegation.
Fields§
§events: VirtualEvents
The closures that are currently attached to elements in the page. We keep these around so that they don’t get dropped, (and thus stop working).
Implementations§
source§impl PercyDom
impl PercyDom
sourcepub fn new(current_vdom: VirtualNode) -> PercyDom
pub fn new(current_vdom: VirtualNode) -> PercyDom
Create a new PercyDom
.
A root Node
will be created but not added to your DOM.
sourcepub fn new_append_to_mount(
current_vdom: VirtualNode,
mount: &Element
) -> PercyDom
pub fn new_append_to_mount( current_vdom: VirtualNode, mount: &Element ) -> PercyDom
Create a new PercyDom
.
A root Node
will be created and append (as a child) to your passed
in mount element.
sourcepub fn new_replace_mount(current_vdom: VirtualNode, mount: Element) -> PercyDom
pub fn new_replace_mount(current_vdom: VirtualNode, mount: Element) -> PercyDom
Create a new PercyDom
.
A root Node
will be created and it will replace your passed in mount
element.
sourcepub fn update(&mut self, new_vdom: VirtualNode)
pub fn update(&mut self, new_vdom: VirtualNode)
Diff the current virtual dom with the new virtual dom that is being passed in.
Then use that diff to patch the real DOM in the user’s browser so that they are seeing the latest state of the application.