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

source

pub fn without_closures(node: Node) -> Self

create a simple node with no closure attache

source

pub fn create_text_node(txt: &str) -> Text

create a text node

source

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.

source

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)

source

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

source

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

source

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.

source

pub fn remove_element_attribute<MSG>( element: &Element, attr: &Attribute<MSG> ) -> Result<(), JsValue>

remove element attribute, takes care of special case such as checked

Trait Implementations§

source§

impl Debug for CreatedNode

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.