Struct sauron_core::dom::CreatedNode
source · pub struct CreatedNode {
pub node: Node,
/* private fields */
}
Expand description
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.
Fields§
§node: Node
A Node
or Element
that was created from a Node
Implementations§
source§impl CreatedNode
impl CreatedNode
sourcepub fn without_closures(node: Node) -> Self
pub fn without_closures(node: Node) -> Self
create a simple node with no closure attache
sourcepub fn create_text_node(txt: &str) -> Text
pub fn create_text_node(txt: &str) -> Text
create a text node
sourcepub fn create_dom_node<APP, MSG>(
program: &Program<APP, MSG>,
vnode: &Node<MSG>
) -> CreatedNodewhere
MSG: 'static,
APP: Application<MSG> + 'static,
pub fn create_dom_node<APP, MSG>( program: &Program<APP, MSG>, vnode: &Node<MSG> ) -> CreatedNodewhere MSG: 'static, APP: Application<MSG> + 'static,
Create and return a CreatedNode
instance (containing a DOM Node
together with potentially related closures) for this virtual node.
sourcepub fn dispatch_mount_event(node: &Node)
pub fn dispatch_mount_event(node: &Node)
dispatch the mount event, call the listener since browser don’t allow asynchronous execution of dispatching custom events (non-native browser events)
sourcepub fn append_child_and_dispatch_mount_event(parent: &Node, child_node: &Node)
pub fn append_child_and_dispatch_mount_event(parent: &Node, child_node: &Node)
a helper method to append a node to its parent and trigger a mount event if there is any
sourcepub fn set_element_attributes<APP, MSG>(
program: &Program<APP, MSG>,
closures: &mut BTreeMap<usize, Vec<(&'static str, Closure<dyn FnMut(Event)>)>>,
element: &Element,
attrs: &[&Attribute<MSG>]
)where
MSG: 'static,
APP: Application<MSG> + 'static,
pub fn set_element_attributes<APP, MSG>( program: &Program<APP, MSG>, closures: &mut BTreeMap<usize, Vec<(&'static str, Closure<dyn FnMut(Event)>)>>, element: &Element, attrs: &[&Attribute<MSG>] )where MSG: 'static, APP: Application<MSG> + 'static,
set the element attribute
sourcepub fn set_element_attribute<APP, MSG>(
program: &Program<APP, MSG>,
closures: &mut BTreeMap<usize, Vec<(&'static str, Closure<dyn FnMut(Event)>)>>,
element: &Element,
attr: &Attribute<MSG>
)where
MSG: 'static,
APP: Application<MSG> + 'static,
pub fn set_element_attribute<APP, MSG>( program: &Program<APP, MSG>, closures: &mut BTreeMap<usize, Vec<(&'static str, Closure<dyn FnMut(Event)>)>>, element: &Element, attr: &Attribute<MSG> )where MSG: 'static, APP: Application<MSG> + 'static,
set the element attribute
Note: this is called in a loop, so setting the attributes, and style will not be on the same call, but on a subsequent call to each other. Using the if-else-if here for attributes, style, function_call.