Struct sauron_core::dom::WebComponentWrapper
source · pub struct WebComponentWrapper<APP, MSG>where
MSG: 'static,{
pub program: Program<APP, MSG>,
}Expand description
A self contain web component This is needed to move some of the code from the #custom_element 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
Fields§
§program: Program<APP, MSG>the underlying program running this web component
Implementations§
source§impl<APP, MSG> WebComponentWrapper<APP, MSG>where
APP: Application<MSG> + WebComponent<MSG> + Default + 'static,
MSG: 'static,
impl<APP, MSG> WebComponentWrapper<APP, MSG>where APP: Application<MSG> + WebComponent<MSG> + Default + 'static, 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 WebComponentWrapper<APP, MSG>
impl<APP, MSG> !Send for WebComponentWrapper<APP, MSG>
impl<APP, MSG> !Sync for WebComponentWrapper<APP, MSG>
impl<APP, MSG> Unpin for WebComponentWrapper<APP, MSG>
impl<APP, MSG> !UnwindSafe for WebComponentWrapper<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