Struct sauron_core::dom::WebComponent
source · 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,
impl<APP, MSG> WebComponent<APP, MSG>where APP: Application<MSG> + Default + 'static + CustomElement<MSG>, MSG: 'static,
sourcepub fn new(node: JsValue) -> Self
pub fn new(node: JsValue) -> Self
create a new web component, with the node as the target element to be mounted into
sourcepub fn attribute_changed(
&self,
attr_name: &str,
old_value: JsValue,
new_value: JsValue
)
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
sourcepub fn connected_callback(&mut self)
pub fn connected_callback(&mut self)
called when the web component is mounted
sourcepub fn disconnected_callback(&mut self)
pub fn disconnected_callback(&mut self)
called when the web component is removed
sourcepub fn adopted_callback(&mut self)
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more