pub struct DomUpdater<MSG> {
    pub current_vdom: Node<MSG>,
    pub root_node: Option<Node>,
    pub mount_node: Node,
    pub active_closures: HashMap<usize, Vec<(&'static str, Closure<dyn FnMut(Event)>)>>,
    pub focused_node: Option<Node>,
    pub replace: bool,
    pub use_shadow: bool,
}
Expand description

Used for keeping a real DOM node up to date based on the current Node and a new incoming Node that represents our latest DOM state.

Fields

current_vdom: Node<MSG>

the current vdom representation

root_node: Option<Node>

the first element of the app view, where the patch is generated is relative to

mount_node: Node

the actual DOM element where the APP is mounted to.

active_closures: HashMap<usize, Vec<(&'static str, Closure<dyn FnMut(Event)>)>>

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);

focused_node: Option<Node>

after mounting or update dispatch call, the element will be focused

replace: bool

if the mount node is replaced by the root_node

use_shadow: bool

whether or not to use shadow root of the mount_node

Implementations

count the total active closures regardless of which element it attached to.

each element and it’s descendant in the vdom is created into an actual DOM node.

inject style element to the mount node

Create a new DomUpdater.

A root Node will be created and appended (as a child) to your passed in mount element.

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.

Return the total number of patches applied

Apply patches blindly to the root_node in this DomUpdater.

Warning: only used this for debugging purposes

Return the root node of your application, the highest ancestor of all other nodes in your real DOM tree.

Return the root node of your application, the highest ancestor of all other nodes in your real DOM tree.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.