pub struct WebComponent<APP, MSG>where
    MSG: 'static,{ /* private fields */ }
Expand description

A self contain web component This is needed to move some of the code from the #web_component macro This is also necessary, since #[wasm_bindgen] macro can not process impl types which uses generics, we use generics here to simplify the code and do the type checks for us, rather than in the code derived from the #[web_component] macro

Implementations§

source§

impl<APP, MSG> WebComponent<APP, MSG>where APP: Application<MSG> + Default + 'static + CustomElement<MSG>, MSG: 'static,

source

pub fn new(node: JsValue) -> Self

create a new web component, with the node as the target element to be mounted into

source

pub fn attribute_changed( &self, attr_name: &str, old_value: JsValue, new_value: JsValue )

When the attribute of the component is changed, this method will be called

source

pub fn connected_callback(&mut self)

called when the web component is mounted

source

pub fn disconnected_callback(&mut self)

called when the web component is removed

source

pub fn adopted_callback(&mut self)

called when web componented is moved into other parts of the document

Auto Trait Implementations§

§

impl<APP, MSG> !RefUnwindSafe for WebComponent<APP, MSG>

§

impl<APP, MSG> !Send for WebComponent<APP, MSG>

§

impl<APP, MSG> !Sync for WebComponent<APP, MSG>

§

impl<APP, MSG> Unpin for WebComponent<APP, MSG>

§

impl<APP, MSG> !UnwindSafe for WebComponent<APP, MSG>

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.